Issue #18408: Fix create_extra() of _elementtree.c, raise MemoryError on memory

allocation failure
This commit is contained in:
Victor Stinner 2013-07-12 02:03:34 +02:00
parent df4572cc71
commit 81aac734e1
1 changed files with 3 additions and 1 deletions

View 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;