summaryrefslogtreecommitdiff
path: root/Objects/typeobject.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2016-08-20 02:37:41 +0200
committerVictor Stinner <victor.stinner@gmail.com>2016-08-20 02:37:41 +0200
commit253021dd945b824097415d76b5925a82b9b3e0bc (patch)
treef85ddd7fcf52755e24195efe64eb606e58784b0f /Objects/typeobject.c
parentea5e5990c9a26b81b149417239e0fe435a621818 (diff)
downloadcpython-git-253021dd945b824097415d76b5925a82b9b3e0bc.tar.gz
Issue #27366: Fix init_subclass()
Handle PyTuple_New(0) failure.
Diffstat (limited to 'Objects/typeobject.c')
-rw-r--r--Objects/typeobject.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 68e4f90ab6..0f18355853 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);