[Python-checkins] cpython: Issue #18408: Fix create_extra() of _elementtree.c, raise MemoryError on memory

victor.stinner python-checkins at python.org
Fri Jul 12 02:07:51 CEST 2013


http://hg.python.org/cpython/rev/60b1d7967ef8
changeset:   84580:60b1d7967ef8
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Fri Jul 12 02:03:34 2013 +0200
summary:
  Issue #18408: Fix create_extra() of _elementtree.c, raise MemoryError on memory
allocation failure

files:
  Modules/_elementtree.c |  4 +++-
  1 files changed, 3 insertions(+), 1 deletions(-)


diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c
--- a/Modules/_elementtree.c
+++ b/Modules/_elementtree.c
@@ -170,8 +170,10 @@
 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;

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


More information about the Python-checkins mailing list