diff --git a/Tests/test_imagecms.py b/Tests/test_imagecms.py index 6eb422c4049..dd9651bdbf7 100644 --- a/Tests/test_imagecms.py +++ b/Tests/test_imagecms.py @@ -514,6 +514,15 @@ def test_profile_typesafety(): ImageCms.core.CmsProfile(0) +@pytest.mark.skipif(is_pypy(), reason="fails on PyPy") +def test_transform_typesafety(): + # 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, transform_in_place, preserved_channel): def create_test_image(): # set up test image with something interesting in the tested aux channel. diff --git a/src/_imagingcms.c b/src/_imagingcms.c index 0bbd662fa54..dde5a002f50 100644 --- a/src/_imagingcms.c +++ b/src/_imagingcms.c @@ -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() */