Issue #27366: Fix init_subclass()

Handle PyTuple_New(0) failure.
This commit is contained in:
Victor Stinner 2016-08-20 02:37:41 +02:00
parent ea5e5990c9
commit 253021dd94
1 changed files with 5 additions and 0 deletions

View File

@ -7018,6 +7018,11 @@ init_subclass(PyTypeObject *type, PyObject *kwds)
return -1; return -1;
tuple = PyTuple_New(0); tuple = PyTuple_New(0);
if (tuple == NULL) {
Py_DECREF(func);
return 0;
}
tmp = PyObject_Call(func, tuple, kwds); tmp = PyObject_Call(func, tuple, kwds);
Py_DECREF(tuple); Py_DECREF(tuple);
Py_DECREF(func); Py_DECREF(func);