mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-06-23 14:33:29 +03:00
py3k -- PyUnicode_FromString instead of PyString_fromString
This commit is contained in:
parent
014ca1497d
commit
a7488d287e
9
_webp.c
9
_webp.c
|
@ -114,7 +114,7 @@ PyObject* WebPDecode_wrapper(PyObject* self, PyObject* args)
|
||||||
PyBytesObject *webp_string;
|
PyBytesObject *webp_string;
|
||||||
uint8_t *webp;
|
uint8_t *webp;
|
||||||
Py_ssize_t size;
|
Py_ssize_t size;
|
||||||
PyObject *ret, *bytes;
|
PyObject *ret, *bytes, *pymode;
|
||||||
WebPDecoderConfig config;
|
WebPDecoderConfig config;
|
||||||
VP8StatusCode vp8_status_code = VP8_STATUS_OK;
|
VP8StatusCode vp8_status_code = VP8_STATUS_OK;
|
||||||
char* mode = "RGB";
|
char* mode = "RGB";
|
||||||
|
@ -157,8 +157,13 @@ PyObject* WebPDecode_wrapper(PyObject* self, PyObject* args)
|
||||||
config.output.u.YUVA.y_size);
|
config.output.u.YUVA.y_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if PY_VERSION_HEX >= 0x03000000
|
||||||
|
pymode = PyUnicode_FromString(mode);
|
||||||
|
#else
|
||||||
|
pymode = PyString_FromString(mode);
|
||||||
|
#endif
|
||||||
ret = Py_BuildValue("SiiS", bytes, config.output.width,
|
ret = Py_BuildValue("SiiS", bytes, config.output.width,
|
||||||
config.output.height, PyBytes_FromString(mode));
|
config.output.height, pymode);
|
||||||
WebPFreeDecBuffer(&config.output);
|
WebPFreeDecBuffer(&config.output);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user