diff --git a/_imagingcms.c b/_imagingcms.c index 6b215cabb..b29203471 100644 --- a/_imagingcms.c +++ b/_imagingcms.c @@ -522,19 +522,19 @@ static struct PyMethodDef cms_profile_methods[] = { static PyObject* cms_profile_getattr_product_name(CmsProfileObject* self, void* closure) { - return PyUnicode_FromString(cmsTakeProductName(self->profile)); + return PyUnicode_DecodeFSDefault(cmsTakeProductName(self->profile)); } static PyObject* cms_profile_getattr_product_desc(CmsProfileObject* self, void* closure) { - return PyUnicode_FromString(cmsTakeProductDesc(self->profile)); + return PyUnicode_DecodeFSDefault(cmsTakeProductDesc(self->profile)); } static PyObject* cms_profile_getattr_product_info(CmsProfileObject* self, void* closure) { - return PyUnicode_FromString(cmsTakeProductInfo(self->profile)); + return PyUnicode_DecodeFSDefault(cmsTakeProductInfo(self->profile)); } static PyObject* @@ -546,13 +546,13 @@ cms_profile_getattr_rendering_intent(CmsProfileObject* self, void* closure) static PyObject* cms_profile_getattr_pcs(CmsProfileObject* self, void* closure) { - return PyUnicode_FromString(findICmode(cmsGetPCS(self->profile))); + return PyUnicode_DecodeFSDefault(findICmode(cmsGetPCS(self->profile))); } static PyObject* cms_profile_getattr_color_space(CmsProfileObject* self, void* closure) { - return PyUnicode_FromString(findICmode(cmsGetColorSpace(self->profile))); + return PyUnicode_DecodeFSDefault(findICmode(cmsGetColorSpace(self->profile))); } /* FIXME: add more properties (creation_datetime etc) */ diff --git a/py3.h b/py3.h index e0658b0bb..85979c81c 100644 --- a/py3.h +++ b/py3.h @@ -30,6 +30,7 @@ #undef PyUnicode_FromStringAndSize #undef PyUnicode_FromString #undef PyUnicode_FromFormat +#undef PyUnicode_DecodeFSDefault #define PyUnicode_AsString PyString_AsString #define PyUnicode_AS_STRING PyString_AS_STRING @@ -37,6 +38,7 @@ #define PyUnicode_FromStringAndSize PyString_FromStringAndSize #define PyUnicode_FromString PyString_FromString #define PyUnicode_FromFormat PyString_FromFormat +#define PyUnicode_DecodeFSDefault PyString_FromString #endif /* Map PyBytes -> PyString */