diff Objects/typeobject.c @ 84512:de1473f4503b

Issue #18408: Fix PyType_Ready() and type.__bases__ setter to handle PyWeakref_NewRef() failure (ex: MemoryError).
author Victor Stinner <victor.stinner@gmail.com>
date Mon, 08 Jul 2013 22:25:48 +0200
parents bb8093e427f9
children a2d6274e2fc8
line wrap: on
line diff
--- a/Objects/typeobject.c	Mon Jul 08 22:23:32 2013 +0200
+++ b/Objects/typeobject.c	Mon Jul 08 22:25:48 2013 +0200
@@ -4329,6 +4329,8 @@
     }
     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);