summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-10-31 15:34:08 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-10-31 15:34:08 (GMT)
commite75996a77ca1974ffa36f9b7be6cd9d3023c49e7 (patch)
tree9524ab399242eaa216fa1b47f061ac8ec8532ec5
parenta215002453880eb5f62786cb0010065e3dc3bf74 (diff)
downloadcpython-e75996a77ca1974ffa36f9b7be6cd9d3023c49e7.zip
cpython-e75996a77ca1974ffa36f9b7be6cd9d3023c49e7.tar.gz
cpython-e75996a77ca1974ffa36f9b7be6cd9d3023c49e7.tar.bz2
Issue #19437: Fix PyCFuncPtrType constructor, handle
_ctypes_alloc_format_string() failure
-rw-r--r--Modules/_ctypes/_ctypes.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index 32d67b0..0deffa0 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -2245,6 +2245,10 @@ PyCFuncPtrType_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
argtypes would be a ctypes type).
*/
stgdict->format = _ctypes_alloc_format_string(NULL, "X{}");
+ if (stgdict->format == NULL) {
+ Py_DECREF((PyObject *)stgdict);
+ return NULL;
+ }
stgdict->flags |= TYPEFLAG_ISPOINTER;
/* create the new instance (which is a class,