diff --git a/Tests/test_imagecms.py b/Tests/test_imagecms.py index 6bd27baf6..3c5ced05c 100644 --- a/Tests/test_imagecms.py +++ b/Tests/test_imagecms.py @@ -371,8 +371,13 @@ class TestImageCms(PillowTestCase): self.assertEqual(result, 'XYZ') self.assertIsNone(p.perceptual_rendering_intent_gamut) - self.assertEqual(p.product_copyright, - 'Copyright International Color Consortium, 2009') + + # p.product_copyright + result = self.assert_warning( + DeprecationWarning, getattr, p, "product_copyright" + ) + self.assertEqual(result, "Copyright International Color Consortium, 2009") + self.assertEqual(p.product_desc, 'sRGB IEC61966-2-1 black scaled') self.assertEqual(p.product_description, 'sRGB IEC61966-2-1 black scaled') diff --git a/src/PIL/ImageCms.py b/src/PIL/ImageCms.py index 6188d71b4..e3f920f33 100644 --- a/src/PIL/ImageCms.py +++ b/src/PIL/ImageCms.py @@ -728,7 +728,7 @@ def getProfileInfo(profile): # so skipping. # info was description \r\n\r\n copyright \r\n\r\n K007 tag \r\n\r\n whitepoint description = profile.profile.product_description - cpright = profile.profile.product_copyright + cpright = profile.profile.copyright arr = [] for elt in (description, cpright): if elt: @@ -762,7 +762,7 @@ def getProfileCopyright(profile): # add an extra newline to preserve pyCMS compatibility if not isinstance(profile, ImageCmsProfile): profile = ImageCmsProfile(profile) - return profile.profile.product_copyright + "\n" + return (profile.profile.copyright or "") + "\n" except (AttributeError, IOError, TypeError, ValueError) as v: raise PyCMSError(v) diff --git a/src/_imagingcms.c b/src/_imagingcms.c index 006450a58..9f13f0c88 100644 --- a/src/_imagingcms.c +++ b/src/_imagingcms.c @@ -997,6 +997,8 @@ cms_profile_getattr_product_manufacturer(CmsProfileObject* self, void* closure) static PyObject* cms_profile_getattr_product_copyright(CmsProfileObject* self, void* closure) { + PyErr_WarnEx(PyExc_DeprecationWarning, + "product_copyright is deprecated. Use Unicode copyright instead.", 1); return _profile_getattr(self, cmsInfoCopyright); }