summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_ctypes/_ctypes.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index 4c4720e..1e0f963 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -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)