Skip to content

Commit b136f11

Browse files
authored
bpo-30892: Fix _elementtree module initialization (#2647)
Handle getattr(copy, 'deepcopy') error in _elementtree module initialization.
1 parent aa8d0a2 commit b136f11

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Modules/_elementtree.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3990,6 +3990,11 @@ PyInit__elementtree(void)
39903990
st->deepcopy_obj = PyObject_GetAttrString(temp, "deepcopy");
39913991
Py_XDECREF(temp);
39923992

3993+
if (st->deepcopy_obj == NULL) {
3994+
return NULL;
3995+
}
3996+
3997+
assert(!PyErr_Occurred());
39933998
if (!(st->elementpath_obj = PyImport_ImportModule("xml.etree.ElementPath")))
39943999
return NULL;
39954000

0 commit comments

Comments
 (0)