mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #18408: Fix PyType_Ready() and type.__bases__ setter to handle
PyWeakref_NewRef() failure (ex: MemoryError).
This commit is contained in:
parent
3a8b79d4d2
commit
9812af8e72
1 changed files with 2 additions and 0 deletions
|
@ -4329,6 +4329,8 @@ add_subclass(PyTypeObject *base, PyTypeObject *type)
|
|||
}
|
||||
assert(PyList_Check(list));
|
||||
newobj = PyWeakref_NewRef((PyObject *)type, NULL);
|
||||
if (newobj == NULL)
|
||||
return -1;
|
||||
i = PyList_GET_SIZE(list);
|
||||
while (--i >= 0) {
|
||||
ref = PyList_GET_ITEM(list, i);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue