From 9812af8e727ee38f6526d377d84fb7f4507e23bc Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 8 Jul 2013 22:25:48 +0200 Subject: Issue #18408: Fix PyType_Ready() and type.__bases__ setter to handle PyWeakref_NewRef() failure (ex: MemoryError). --- Objects/typeobject.c | 2 ++ 1 file changed, 2 insertions(+) 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); -- cgit v0.12