]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #19437: Fix error handling of PyCArrayType_new(), don't decreases the
authorVictor Stinner <victor.stinner@gmail.com>
Mon, 18 Nov 2013 17:37:33 +0000 (18:37 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Mon, 18 Nov 2013 17:37:33 +0000 (18:37 +0100)
reference counter of stgdict after result stole a reference to it

Modules/_ctypes/_ctypes.c

index be0f33a69e9f788a7180548a1bb5579492855de8..820a6060950ae6f921ff93af5587e500242a5593 100644 (file)
@@ -1342,7 +1342,8 @@ PyCArrayType_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
     if (-1 == PyDict_Update((PyObject *)stgdict, result->tp_dict))
         goto error;
     Py_DECREF(result->tp_dict);
-    result->tp_dict = (PyObject *)stgdict;
+    result->tp_dict = (PyObject *)stgdict;  /* steal the reference */
+    stgdict = NULL;
 
     /* Special case for character arrays.
        A permanent annoyance: char arrays are also strings!