Fix a potential 'SystemError: NULL result without error'.

NULL may be a valid return value from PyLong_AsVoidPtr.

Will backport to release25-maint.
This commit is contained in:
Thomas Heller 2008-01-11 20:29:19 +00:00
parent c682614df0
commit 43617bc610
1 changed files with 1 additions and 1 deletions

View File

@ -2899,7 +2899,7 @@ CFuncPtr_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|| PyLong_Check(PyTuple_GET_ITEM(args, 0)))) {
CDataObject *ob;
void *ptr = PyLong_AsVoidPtr(PyTuple_GET_ITEM(args, 0));
if (ptr == NULL)
if (ptr == NULL && PyErr_Occurred())
return NULL;
ob = (CDataObject *)GenericCData_new(type, args, kwds);
if (ob == NULL)