[Python-checkins] cpython: Issue #27366: Fix init_subclass()

victor.stinner python-checkins at python.org
Fri Aug 19 20:38:45 EDT 2016


https://hg.python.org/cpython/rev/545bfa4c20eb
changeset:   102789:545bfa4c20eb
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Sat Aug 20 02:37:41 2016 +0200
summary:
  Issue #27366: Fix init_subclass()

Handle PyTuple_New(0) failure.

files:
  Objects/typeobject.c |  5 +++++
  1 files changed, 5 insertions(+), 0 deletions(-)


diff --git a/Objects/typeobject.c b/Objects/typeobject.c
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -7018,6 +7018,11 @@
         return -1;
 
     tuple = PyTuple_New(0);
+    if (tuple == NULL) {
+        Py_DECREF(func);
+        return 0;
+    }
+
     tmp = PyObject_Call(func, tuple, kwds);
     Py_DECREF(tuple);
     Py_DECREF(func);

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


More information about the Python-checkins mailing list