Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 81aac73

Browse files
committed
Issue #18408: Fix create_extra() of _elementtree.c, raise MemoryError on memory
allocation failure
1 parent df4572c commit 81aac73

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

Modules/_elementtree.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,10 @@ LOCAL(int)
170170
create_extra(ElementObject* self, PyObject* attrib)
171171
{
172172
self->extra = PyObject_Malloc(sizeof(ElementObjectExtra));
173-
if (!self->extra)
173+
if (!self->extra) {
174+
PyErr_NoMemory();
174175
return -1;
176+
}
175177

176178
if (!attrib)
177179
attrib = Py_None;

0 commit comments

Comments
 (0)