From 0015e9ce6821d4c4c6313d28eb3e0d1e58078078 Mon Sep 17 00:00:00 2001 From: Nulano Date: Tue, 2 Jan 2024 00:25:57 +0100 Subject: [PATCH] expose ImageCms.core.CmsTransform --- Tests/test_imagecms.py | 9 +++++++++ src/_imagingcms.c | 3 +++ 2 files changed, 12 insertions(+) diff --git a/Tests/test_imagecms.py b/Tests/test_imagecms.py index 821443e39..c80fab75b 100644 --- a/Tests/test_imagecms.py +++ b/Tests/test_imagecms.py @@ -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: diff --git a/src/_imagingcms.c b/src/_imagingcms.c index 5ffb20a6a..b50c577d8 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() */