Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 253021d

Browse files
committed
Issue #27366: Fix init_subclass()
Handle PyTuple_New(0) failure.
1 parent ea5e599 commit 253021d

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

Objects/typeobject.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7018,6 +7018,11 @@ init_subclass(PyTypeObject *type, PyObject *kwds)
70187018
return -1;
70197019

70207020
tuple = PyTuple_New(0);
7021+
if (tuple == NULL) {
7022+
Py_DECREF(func);
7023+
return 0;
7024+
}
7025+
70217026
tmp = PyObject_Call(func, tuple, kwds);
70227027
Py_DECREF(tuple);
70237028
Py_DECREF(func);

0 commit comments

Comments
 (0)