]> granicus.if.org Git - python/commitdiff
Issue #18408: Fix create_extra() of _elementtree.c, raise MemoryError on memory
authorVictor Stinner <victor.stinner@gmail.com>
Fri, 12 Jul 2013 00:03:34 +0000 (02:03 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Fri, 12 Jul 2013 00:03:34 +0000 (02:03 +0200)
allocation failure

Modules/_elementtree.c

index 9a71c4376a07e40515e9aedb6580eb44cee615ed..7c01a602888a74e80a0b73e6fc192ec673b54345 100644 (file)
@@ -170,8 +170,10 @@ LOCAL(int)
 create_extra(ElementObject* self, PyObject* attrib)
 {
     self->extra = PyObject_Malloc(sizeof(ElementObjectExtra));
-    if (!self->extra)
+    if (!self->extra) {
+        PyErr_NoMemory();
         return -1;
+    }
 
     if (!attrib)
         attrib = Py_None;