From 81aac734e1003d93e6a21d2c8a4943f6398aa419 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Fri, 12 Jul 2013 02:03:34 +0200 Subject: [PATCH] Issue #18408: Fix create_extra() of _elementtree.c, raise MemoryError on memory allocation failure --- Modules/_elementtree.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c index 9a71c4376a0..7c01a602888 100644 --- a/Modules/_elementtree.c +++ b/Modules/_elementtree.c @@ -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;