From 253021dd945b824097415d76b5925a82b9b3e0bc Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Sat, 20 Aug 2016 02:37:41 +0200 Subject: [PATCH] Issue #27366: Fix init_subclass() Handle PyTuple_New(0) failure. --- Objects/typeobject.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 68e4f90ab6b..0f183558532 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);