Commit 9812af8e authored by Victor Stinner's avatar Victor Stinner

Issue #18408: Fix PyType_Ready() and type.__bases__ setter to handle

PyWeakref_NewRef() failure (ex: MemoryError).
parent 3a8b79d4
...@@ -4329,6 +4329,8 @@ add_subclass(PyTypeObject *base, PyTypeObject *type) ...@@ -4329,6 +4329,8 @@ add_subclass(PyTypeObject *base, PyTypeObject *type)
} }
assert(PyList_Check(list)); assert(PyList_Check(list));
newobj = PyWeakref_NewRef((PyObject *)type, NULL); newobj = PyWeakref_NewRef((PyObject *)type, NULL);
if (newobj == NULL)
return -1;
i = PyList_GET_SIZE(list); i = PyList_GET_SIZE(list);
while (--i >= 0) { while (--i >= 0) {
ref = PyList_GET_ITEM(list, i); ref = PyList_GET_ITEM(list, i);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment