Issue #18408: Fix create_extra() of _elementtree.c, raise MemoryError on memory
allocation failure
diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c
index 9a71c43..7c01a60 100644
--- 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;