[Python-checkins] cpython: Issue #19437: Fix PyCFuncPtrType constructor, handle

victor.stinner python-checkins at python.org
Thu Oct 31 17:23:58 CET 2013


http://hg.python.org/cpython/rev/a0e2c2cb60f6
changeset:   86805:a0e2c2cb60f6
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Thu Oct 31 16:34:08 2013 +0100
summary:
  Issue #19437: Fix PyCFuncPtrType constructor, handle
_ctypes_alloc_format_string() failure

files:
  Modules/_ctypes/_ctypes.c |  4 ++++
  1 files changed, 4 insertions(+), 0 deletions(-)


diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -2245,6 +2245,10 @@
        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,

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list