]> granicus.if.org Git - python/commitdiff
Issue #18408: Fix PyType_Ready() and type.__bases__ setter to handle
authorVictor Stinner <victor.stinner@gmail.com>
Mon, 8 Jul 2013 20:25:48 +0000 (22:25 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Mon, 8 Jul 2013 20:25:48 +0000 (22:25 +0200)
PyWeakref_NewRef() failure (ex: MemoryError).

Objects/typeobject.c

index a3516671a74da2c8cc0d04e264b0b135190b80e9..5565b20662aa4abcf497666e6f3fc50a3a262acf 100644 (file)
@@ -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);