mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-27 09:44:31 +03:00
PyModule_AddObject fix for Python 3.10
This commit is contained in:
parent
2bbb82a019
commit
cf190a3c2f
|
@ -4134,8 +4134,9 @@ setup_module(PyObject *m) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
PyObject *have_libjpegturbo;
|
||||||
#ifdef LIBJPEG_TURBO_VERSION
|
#ifdef LIBJPEG_TURBO_VERSION
|
||||||
PyModule_AddObject(m, "HAVE_LIBJPEGTURBO", Py_True);
|
have_libjpegturbo = Py_True;
|
||||||
#define tostr1(a) #a
|
#define tostr1(a) #a
|
||||||
#define tostr(a) tostr1(a)
|
#define tostr(a) tostr1(a)
|
||||||
PyDict_SetItemString(
|
PyDict_SetItemString(
|
||||||
|
@ -4143,19 +4144,24 @@ setup_module(PyObject *m) {
|
||||||
#undef tostr
|
#undef tostr
|
||||||
#undef tostr1
|
#undef tostr1
|
||||||
#else
|
#else
|
||||||
PyModule_AddObject(m, "HAVE_LIBJPEGTURBO", Py_False);
|
have_libjpegturbo = Py_False;
|
||||||
#endif
|
#endif
|
||||||
|
Py_INCREF(have_libjpegturbo);
|
||||||
|
PyModule_AddObject(m, "HAVE_LIBJPEGTURBO", have_libjpegturbo);
|
||||||
|
|
||||||
|
PyObject *have_libimagequant;
|
||||||
#ifdef HAVE_LIBIMAGEQUANT
|
#ifdef HAVE_LIBIMAGEQUANT
|
||||||
PyModule_AddObject(m, "HAVE_LIBIMAGEQUANT", Py_True);
|
have_libimagequant = Py_True;
|
||||||
{
|
{
|
||||||
extern const char *ImagingImageQuantVersion(void);
|
extern const char *ImagingImageQuantVersion(void);
|
||||||
PyDict_SetItemString(
|
PyDict_SetItemString(
|
||||||
d, "imagequant_version", PyUnicode_FromString(ImagingImageQuantVersion()));
|
d, "imagequant_version", PyUnicode_FromString(ImagingImageQuantVersion()));
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
PyModule_AddObject(m, "HAVE_LIBIMAGEQUANT", Py_False);
|
have_libimagequant = Py_False;
|
||||||
#endif
|
#endif
|
||||||
|
Py_INCREF(have_libimagequant);
|
||||||
|
PyModule_AddObject(m, "HAVE_LIBIMAGEQUANT", have_libimagequant);
|
||||||
|
|
||||||
#ifdef HAVE_LIBZ
|
#ifdef HAVE_LIBZ
|
||||||
/* zip encoding strategies */
|
/* zip encoding strategies */
|
||||||
|
@ -4189,11 +4195,14 @@ setup_module(PyObject *m) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
PyObject *have_xcb;
|
||||||
#ifdef HAVE_XCB
|
#ifdef HAVE_XCB
|
||||||
PyModule_AddObject(m, "HAVE_XCB", Py_True);
|
have_xcb = Py_True;
|
||||||
#else
|
#else
|
||||||
PyModule_AddObject(m, "HAVE_XCB", Py_False);
|
have_xcb = Py_False;
|
||||||
#endif
|
#endif
|
||||||
|
Py_INCREF(have_xcb);
|
||||||
|
PyModule_AddObject(m, "HAVE_XCB", have_xcb);
|
||||||
|
|
||||||
PyDict_SetItemString(d, "PILLOW_VERSION", PyUnicode_FromString(version));
|
PyDict_SetItemString(d, "PILLOW_VERSION", PyUnicode_FromString(version));
|
||||||
|
|
||||||
|
|
14
src/_webp.c
14
src/_webp.c
|
@ -920,20 +920,26 @@ static PyMethodDef webpMethods[] = {
|
||||||
|
|
||||||
void
|
void
|
||||||
addMuxFlagToModule(PyObject *m) {
|
addMuxFlagToModule(PyObject *m) {
|
||||||
|
PyObject *have_webpmux;
|
||||||
#ifdef HAVE_WEBPMUX
|
#ifdef HAVE_WEBPMUX
|
||||||
PyModule_AddObject(m, "HAVE_WEBPMUX", Py_True);
|
have_webpmux = Py_True;
|
||||||
#else
|
#else
|
||||||
PyModule_AddObject(m, "HAVE_WEBPMUX", Py_False);
|
have_webpmux = Py_False;
|
||||||
#endif
|
#endif
|
||||||
|
Py_INCREF(have_webpmux);
|
||||||
|
PyModule_AddObject(m, "HAVE_WEBPMUX", have_webpmux);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
addAnimFlagToModule(PyObject *m) {
|
addAnimFlagToModule(PyObject *m) {
|
||||||
|
PyObject *have_webpanim;
|
||||||
#ifdef HAVE_WEBPANIM
|
#ifdef HAVE_WEBPANIM
|
||||||
PyModule_AddObject(m, "HAVE_WEBPANIM", Py_True);
|
have_webpanim = Py_True;
|
||||||
#else
|
#else
|
||||||
PyModule_AddObject(m, "HAVE_WEBPANIM", Py_False);
|
have_webpanim = Py_False;
|
||||||
#endif
|
#endif
|
||||||
|
Py_INCREF(have_webpanim);
|
||||||
|
PyModule_AddObject(m, "HAVE_WEBPANIM", have_webpanim);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in New Issue
Block a user