bpo-30892: Fix _elementtree module initialization (#2647) · python/cpython@b136f11 (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

Commit b136f11

bpo-30892: Fix _elementtree module initialization (#2647)

Handle getattr(copy, 'deepcopy') error in _elementtree module initialization.

File tree

1 file changed

lines changed

1 file changed

lines changed

Original file line number Diff line number Diff line change
@@ -3990,6 +3990,11 @@ PyInit__elementtree(void)
3990 3990 st->deepcopy_obj = PyObject_GetAttrString(temp, "deepcopy");
3991 3991 Py_XDECREF(temp);
3992 3992
3993 +if (st->deepcopy_obj == NULL) {
3994 +return NULL;
3995 + }
3996 +
3997 +assert(!PyErr_Occurred());
3993 3998 if (!(st->elementpath_obj = PyImport_ImportModule("xml.etree.ElementPath")))
3994 3999 return NULL;
3995 4000