Handle getattr(copy, 'deepcopy') error in _elementtree module
initialization.
(cherry picked from commit b136f11f3a
)
This commit is contained in:
parent
8e3f73e549
commit
044e156426
|
@ -3947,6 +3947,11 @@ PyInit__elementtree(void)
|
||||||
st->deepcopy_obj = PyObject_GetAttrString(temp, "deepcopy");
|
st->deepcopy_obj = PyObject_GetAttrString(temp, "deepcopy");
|
||||||
Py_XDECREF(temp);
|
Py_XDECREF(temp);
|
||||||
|
|
||||||
|
if (st->deepcopy_obj == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
assert(!PyErr_Occurred());
|
||||||
if (!(st->elementpath_obj = PyImport_ImportModule("xml.etree.ElementPath")))
|
if (!(st->elementpath_obj = PyImport_ImportModule("xml.etree.ElementPath")))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue