diff --git a/Tests/test_imagecms.py b/Tests/test_imagecms.py index 3bc493a72d8..477bd86a254 100644 --- a/Tests/test_imagecms.py +++ b/Tests/test_imagecms.py @@ -494,11 +494,6 @@ def test_non_ascii_path(tmp_path): def test_profile_typesafety(): - """Profile init type safety - - prepatch, these would segfault, postpatch they should emit a typeerror - """ - with pytest.raises(TypeError, match="Invalid type for Profile"): ImageCms.ImageCmsProfile(0).tobytes() with pytest.raises(TypeError, match="Invalid type for Profile"): @@ -510,6 +505,12 @@ def test_profile_typesafety(): with pytest.raises(TypeError): ImageCms.core.profile_tobytes(1) + # core profile 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(): diff --git a/src/_imagingcms.c b/src/_imagingcms.c index 2d6d22dd137..0bbd662fa54 100644 --- a/src/_imagingcms.c +++ b/src/_imagingcms.c @@ -1511,8 +1511,6 @@ setup_module(PyObject *m) { PyObject *v; int vn; - CmsProfile_Type.tp_new = PyType_GenericNew; - /* Ready object types */ PyType_Ready(&CmsProfile_Type); PyType_Ready(&CmsTransform_Type);