summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-07-08 20:25:48 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-07-08 20:25:48 (GMT)
commit9812af8e727ee38f6526d377d84fb7f4507e23bc (patch)
treefa4cf867d117b717d885dd4ffe2b29ff41ccf2d0 /Objects
parent3a8b79d4d2b64e1a80512845edcc388b1ec76dcd (diff)
downloadcpython-9812af8e727ee38f6526d377d84fb7f4507e23bc.zip
cpython-9812af8e727ee38f6526d377d84fb7f4507e23bc.tar.gz
cpython-9812af8e727ee38f6526d377d84fb7f4507e23bc.tar.bz2
Issue #18408: Fix PyType_Ready() and type.__bases__ setter to handle
PyWeakref_NewRef() failure (ex: MemoryError).
Diffstat (limited to 'Objects')
-rw-r--r--Objects/typeobject.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index a351667..5565b20 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -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);