mirror of
https://github.com/python/cpython.git
synced 2025-09-02 15:07:53 +00:00
bpo-30892: Fix _elementtree module initialization (#2647)
Handle getattr(copy, 'deepcopy') error in _elementtree module initialization.
This commit is contained in:
parent
aa8d0a2469
commit
b136f11f3a
1 changed files with 5 additions and 0 deletions
|
@ -3990,6 +3990,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…
Add table
Add a link
Reference in a new issue