Issue #18408: Fix create_extra() of _elementtree.c, raise MemoryError on memory
allocation failure
This commit is contained in:
parent
df4572cc71
commit
81aac734e1
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue