mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 17:36:18 +03:00
Fix Fatal Python error: UNREF invalid object in debug builds
PyObject_Del() should only be called on the self object in a dealloc call, not after failing to make a new object. Replace with Py_DECREF, which eventually calls PyObject_Del() http://bugs.python.org/issue3299#msg78740 https://mail.python.org/pipermail/python-dev/2003-February/033258.html
This commit is contained in:
parent
2af16a7b58
commit
72c45e6f5d
|
@ -153,7 +153,7 @@ getfont(PyObject* self_, PyObject* args, PyObject* kw)
|
|||
if (self->font_bytes) {
|
||||
PyMem_Free(self->font_bytes);
|
||||
}
|
||||
PyObject_Del(self);
|
||||
Py_DECREF(self);
|
||||
return geterror(error);
|
||||
}
|
||||
|
||||
|
|
4
map.c
4
map.c
|
@ -73,7 +73,7 @@ PyImaging_MapperNew(const char* filename, int readonly)
|
|||
NULL);
|
||||
if (mapper->hFile == (HANDLE)-1) {
|
||||
PyErr_SetString(PyExc_IOError, "cannot open file");
|
||||
PyObject_Del(mapper);
|
||||
Py_DECREF(mapper);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ PyImaging_MapperNew(const char* filename, int readonly)
|
|||
if (mapper->hMap == (HANDLE)-1) {
|
||||
CloseHandle(mapper->hFile);
|
||||
PyErr_SetString(PyExc_IOError, "cannot map file");
|
||||
PyObject_Del(mapper);
|
||||
Py_DECREF(mapper);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user