[Python-checkins] cpython: Issue #18408: Fix PyType_Ready() and type.__bases__ setter to handle

victor.stinner python-checkins at python.org
Mon Jul 8 22:36:38 CEST 2013


http://hg.python.org/cpython/rev/de1473f4503b
changeset:   84512:de1473f4503b
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Mon Jul 08 22:25:48 2013 +0200
summary:
  Issue #18408: Fix PyType_Ready() and type.__bases__ setter to handle
PyWeakref_NewRef() failure (ex: MemoryError).

files:
  Objects/typeobject.c |  2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)


diff --git a/Objects/typeobject.c b/Objects/typeobject.c
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -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);

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list