diff options
author | Thomas Heller <theller@ctypes.org> | 2008-01-11 20:29:19 (GMT) |
---|---|---|
committer | Thomas Heller <theller@ctypes.org> | 2008-01-11 20:29:19 (GMT) |
commit | 43617bc610a92d0025a9c9473fdbe0d81c51fd4d (patch) | |
tree | ffc9a48f97e1098c96b6a87e0f607cd30dbf5e0d /Modules | |
parent | c682614df098700c689eabb47c6857f244e85bed (diff) | |
download | cpython-43617bc610a92d0025a9c9473fdbe0d81c51fd4d.zip cpython-43617bc610a92d0025a9c9473fdbe0d81c51fd4d.tar.gz cpython-43617bc610a92d0025a9c9473fdbe0d81c51fd4d.tar.bz2 |
Fix a potential 'SystemError: NULL result without error'.
NULL may be a valid return value from PyLong_AsVoidPtr.
Will backport to release25-maint.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_ctypes/_ctypes.c | 2 |
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) |