summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2016-08-20 00:37:41 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2016-08-20 00:37:41 (GMT)
commit253021dd945b824097415d76b5925a82b9b3e0bc (patch)
treef85ddd7fcf52755e24195efe64eb606e58784b0f
parentea5e5990c9a26b81b149417239e0fe435a621818 (diff)
downloadcpython-253021dd945b824097415d76b5925a82b9b3e0bc.zip
cpython-253021dd945b824097415d76b5925a82b9b3e0bc.tar.gz
cpython-253021dd945b824097415d76b5925a82b9b3e0bc.tar.bz2
Issue #27366: Fix init_subclass()
Handle PyTuple_New(0) failure.
-rw-r--r--Objects/typeobject.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 68e4f90..0f18355 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -7018,6 +7018,11 @@ init_subclass(PyTypeObject *type, PyObject *kwds)
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);