mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 09:56:17 +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*
|
||||
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;
|
||||
/* 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
|
||||
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_SPECIAL) {
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
if (PyLong_Check(color)) {
|
||||
r = (int) PyLong_AsLong(color);
|
||||
if (PyLong_Check(color)) {
|
||||
r = PyLong_AsLongLong(color);
|
||||
#else
|
||||
if (PyInt_Check(color) || PyLong_Check(color)) {
|
||||
if (PyInt_Check(color))
|
||||
r = PyInt_AS_LONG(color);
|
||||
else
|
||||
r = (int) PyLong_AsLong(color);
|
||||
if (PyInt_Check(color) || PyLong_Check(color)) {
|
||||
if (PyInt_Check(color))
|
||||
r = PyInt_AS_LONG(color);
|
||||
else
|
||||
r = PyLong_AsLongLong(color);
|
||||
#endif
|
||||
rIsInt = 1;
|
||||
}
|
||||
if (r == -1 && PyErr_Occurred()) {
|
||||
rIsInt = 0;
|
||||
}
|
||||
if (r == -1 && PyErr_Occurred()) {
|
||||
rIsInt = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user