mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-07-10 16:22:22 +03:00
Fixing SystemError: new style getargs format but argument is not a tuple
This commit is contained in:
parent
c5bace00e3
commit
8dcbf9c12b
27
_imaging.c
27
_imaging.c
|
@ -471,8 +471,13 @@ getpixel(Imaging im, ImagingAccess access, int x, int y)
|
||||||
static char*
|
static char*
|
||||||
getink(PyObject* color, Imaging im, char* ink)
|
getink(PyObject* color, Imaging im, char* ink)
|
||||||
{
|
{
|
||||||
int r=0, g=0, b=0, a=0;
|
int g=0, b=0, a=0;
|
||||||
double f=0;
|
double f=0;
|
||||||
|
/* Windows 64 bit longs are 32 bits, and 0xFFFFFFFF (white) is a
|
||||||
|
python long (not int) that raises an overflow error when trying
|
||||||
|
to return it into a 32 bit C long
|
||||||
|
*/
|
||||||
|
PY_LONG_LONG r = 0;
|
||||||
|
|
||||||
/* fill ink buffer (four bytes) with something that can
|
/* fill ink buffer (four bytes) with something that can
|
||||||
be cast to either UINT8 or INT32 */
|
be cast to either UINT8 or INT32 */
|
||||||
|
@ -482,19 +487,19 @@ getink(PyObject* color, Imaging im, char* ink)
|
||||||
im->type == IMAGING_TYPE_INT32 ||
|
im->type == IMAGING_TYPE_INT32 ||
|
||||||
im->type == IMAGING_TYPE_SPECIAL) {
|
im->type == IMAGING_TYPE_SPECIAL) {
|
||||||
#if PY_VERSION_HEX >= 0x03000000
|
#if PY_VERSION_HEX >= 0x03000000
|
||||||
if (PyLong_Check(color)) {
|
if (PyLong_Check(color)) {
|
||||||
r = (int) PyLong_AsLong(color);
|
r = PyLong_AsLongLong(color);
|
||||||
#else
|
#else
|
||||||
if (PyInt_Check(color) || PyLong_Check(color)) {
|
if (PyInt_Check(color) || PyLong_Check(color)) {
|
||||||
if (PyInt_Check(color))
|
if (PyInt_Check(color))
|
||||||
r = PyInt_AS_LONG(color);
|
r = PyInt_AS_LONG(color);
|
||||||
else
|
else
|
||||||
r = (int) PyLong_AsLong(color);
|
r = PyLong_AsLongLong(color);
|
||||||
#endif
|
#endif
|
||||||
rIsInt = 1;
|
rIsInt = 1;
|
||||||
}
|
}
|
||||||
if (r == -1 && PyErr_Occurred()) {
|
if (r == -1 && PyErr_Occurred()) {
|
||||||
rIsInt = 0;
|
rIsInt = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user