Skip to content

Commit

Permalink
expose ImageCms.core.CmsTransform
Browse files Browse the repository at this point in the history
  • Loading branch information
nulano committed Mar 28, 2024
1 parent 047a0d2 commit 0015e9c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Tests/test_imagecms.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,15 @@ def test_profile_typesafety() -> None:
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(
mode: str, transform_in_place: bool, preserved_channel: str
) -> None:
Expand Down
3 changes: 3 additions & 0 deletions src/_imagingcms.c
Original file line number Diff line number Diff line change
Expand Up @@ -1518,6 +1518,9 @@ setup_module(PyObject *m) {
Py_INCREF(&CmsProfile_Type);
PyModule_AddObject(m, "CmsProfile", (PyObject *)&CmsProfile_Type);

Py_INCREF(&CmsTransform_Type);
PyModule_AddObject(m, "CmsTransform", (PyObject *)&CmsTransform_Type);

d = PyModule_GetDict(m);

/* this check is also in PIL.features.pilinfo() */
Expand Down

0 comments on commit 0015e9c

Please sign in to comment.