From: Victor Stinner Date: Mon, 8 Jul 2013 20:25:48 +0000 (+0200) Subject: Issue #18408: Fix PyType_Ready() and type.__bases__ setter to handle X-Git-Tag: v3.4.0a1~284 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9812af8e727ee38f6526d377d84fb7f4507e23bc;p=python Issue #18408: Fix PyType_Ready() and type.__bases__ setter to handle PyWeakref_NewRef() failure (ex: MemoryError). --- diff --git a/Objects/typeobject.c b/Objects/typeobject.c index a3516671a7..5565b20662 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);