expose ImageCms.core.CmsTransform

This commit is contained in:
Nulano 2024-01-02 00:25:57 +01:00
parent 047a0d2a64
commit 0015e9ce68
2 changed files with 12 additions and 0 deletions

View File

@ -522,6 +522,15 @@ def test_profile_typesafety() -> None:
ImageCms.core.CmsProfile(0) ImageCms.core.CmsProfile(0)
@pytest.mark.skipif(is_pypy(), reason="fails on PyPy")
def test_transform_typesafety() -> None:
# core transform should not be directly instantiable
with pytest.raises(TypeError):
ImageCms.core.CmsProfile()
with pytest.raises(TypeError):
ImageCms.core.CmsProfile(0)
def assert_aux_channel_preserved( def assert_aux_channel_preserved(
mode: str, transform_in_place: bool, preserved_channel: str mode: str, transform_in_place: bool, preserved_channel: str
) -> None: ) -> None:

View File

@ -1518,6 +1518,9 @@ setup_module(PyObject *m) {
Py_INCREF(&CmsProfile_Type); Py_INCREF(&CmsProfile_Type);
PyModule_AddObject(m, "CmsProfile", (PyObject *)&CmsProfile_Type); PyModule_AddObject(m, "CmsProfile", (PyObject *)&CmsProfile_Type);
Py_INCREF(&CmsTransform_Type);
PyModule_AddObject(m, "CmsTransform", (PyObject *)&CmsTransform_Type);
d = PyModule_GetDict(m); d = PyModule_GetDict(m);
/* this check is also in PIL.features.pilinfo() */ /* this check is also in PIL.features.pilinfo() */