File: _imaging.c
Function: _getcolors
Error: ob_refcnt of new ref from (unknown) getpixel is 1 too high
1783 static PyObject* 
1784 _getcolors(ImagingObject* self, PyObject* args)
1785 {
1786     ImagingColorItem* items;
1787     int i, colors;
1788     PyObject* out;
1789 
1790     int maxcolors = 256;
1791     if (!PyArg_ParseTuple(args, "i:getcolors", &maxcolors))
when PyArg_ParseTuple() succeeds
taking False path
1792 	return NULL;
1793 
1794     items = ImagingGetColors(self->image, maxcolors, &colors);
1795     if (!items)
when treating unknown struct ImagingColorItem * from _imaging.c:1794 as non-NULL
taking False path
1796         return NULL;
1797 
1798     if (colors > maxcolors) {
when taking False path
1799         out = Py_None;
1800         Py_INCREF(out);
1801     } else {
1802         out = PyList_New(colors);
when PyList_New() succeeds
1803         for (i = 0; i < colors; i++) {
when taking True path
when taking False path
1804             ImagingColorItem* v = &items[i];
1805             PyObject* item = Py_BuildValue(
when getpixel() succeeds
when Py_BuildValue() fails
new ref from (unknown) getpixel allocated at:             PyObject* item = Py_BuildValue(
ob_refcnt is now refs: 1 + N where N >= 0
1806                 "iN", v->count, getpixel(self->image, self->access, v->x, v->y)
1807                 );
1808             PyList_SetItem(out, i, item);
PyList_SetItem() succeeds
1809         }
1810     }
1811 
1812     free(items);
1813 
1814     return out;
1815 }
ob_refcnt of new ref from (unknown) getpixel is 1 too high
was expecting final ob_refcnt to be N + 0 (for some unknown N)
but final ob_refcnt is N + 1

File: _imaging.c
Function: _getcolors
Error: calling PyList_SetItem with NULL as argument 1 (out) at _imaging.c:1808
1783 static PyObject* 
1784 _getcolors(ImagingObject* self, PyObject* args)
1785 {
1786     ImagingColorItem* items;
1787     int i, colors;
1788     PyObject* out;
1789 
1790     int maxcolors = 256;
1791     if (!PyArg_ParseTuple(args, "i:getcolors", &maxcolors))
when PyArg_ParseTuple() succeeds
taking False path
1792 	return NULL;
1793 
1794     items = ImagingGetColors(self->image, maxcolors, &colors);
1795     if (!items)
when treating unknown struct ImagingColorItem * from _imaging.c:1794 as non-NULL
taking False path
1796         return NULL;
1797 
1798     if (colors > maxcolors) {
when taking False path
1799         out = Py_None;
1800         Py_INCREF(out);
1801     } else {
1802         out = PyList_New(colors);
when PyList_New() fails
1803         for (i = 0; i < colors; i++) {
when taking True path
1804             ImagingColorItem* v = &items[i];
1805             PyObject* item = Py_BuildValue(
when getpixel() succeeds
when Py_BuildValue() succeeds
1806                 "iN", v->count, getpixel(self->image, self->access, v->x, v->y)
1807                 );
1808             PyList_SetItem(out, i, item);
calling PyList_SetItem with NULL as argument 1 (out) at _imaging.c:1808
PyList_SetItem() invokes Py_TYPE() on the pointer via the PyList_Check() macro, thus accessing (NULL)->ob_type
found 2 similar trace(s) to this
1809         }
1810     }
1811 
1812     free(items);
1813 
1814     return out;
1815 }

File: _imaging.c
Function: _getcolors
Error: returning (PyObject*)NULL without setting an exception
1783 static PyObject* 
1784 _getcolors(ImagingObject* self, PyObject* args)
1785 {
1786     ImagingColorItem* items;
1787     int i, colors;
1788     PyObject* out;
1789 
1790     int maxcolors = 256;
1791     if (!PyArg_ParseTuple(args, "i:getcolors", &maxcolors))
when PyArg_ParseTuple() succeeds
taking False path
1792 	return NULL;
1793 
1794     items = ImagingGetColors(self->image, maxcolors, &colors);
1795     if (!items)
when treating unknown struct ImagingColorItem * from _imaging.c:1794 as NULL
taking True path
1796         return NULL;
1797 
1798     if (colors > maxcolors) {
1799         out = Py_None;
1800         Py_INCREF(out);
1801     } else {
1802         out = PyList_New(colors);
1803         for (i = 0; i < colors; i++) {
1804             ImagingColorItem* v = &items[i];
1805             PyObject* item = Py_BuildValue(
1806                 "iN", v->count, getpixel(self->image, self->access, v->x, v->y)
1807                 );
1808             PyList_SetItem(out, i, item);
1809         }
1810     }
1811 
1812     free(items);
1813 
1814     return out;
1815 }
returning (PyObject*)NULL without setting an exception