diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2017-07-10 21:12:37 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-10 21:12:37 (GMT) |
commit | 044e156426825acac8b6c6d1ce14d5b7bcb20bc9 (patch) | |
tree | b510b924a8f0fa7f759be0513cd6a461c3458797 /Modules/_elementtree.c | |
parent | 8e3f73e5499a5bc575a5e7ad4ee0f16b1aaae829 (diff) | |
download | cpython-044e156426825acac8b6c6d1ce14d5b7bcb20bc9.zip cpython-044e156426825acac8b6c6d1ce14d5b7bcb20bc9.tar.gz cpython-044e156426825acac8b6c6d1ce14d5b7bcb20bc9.tar.bz2 |
bpo-30892: Fix _elementtree module initialization (#2647) (#2649)
Handle getattr(copy, 'deepcopy') error in _elementtree module
initialization.
(cherry picked from commit b136f11f3a51f9282ae992bac68f170ca5563b55)
Diffstat (limited to 'Modules/_elementtree.c')
-rw-r--r-- | Modules/_elementtree.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c index bef702e..599ca6a 100644 --- a/Modules/_elementtree.c +++ b/Modules/_elementtree.c @@ -3947,6 +3947,11 @@ PyInit__elementtree(void) st->deepcopy_obj = PyObject_GetAttrString(temp, "deepcopy"); Py_XDECREF(temp); + if (st->deepcopy_obj == NULL) { + return NULL; + } + + assert(!PyErr_Occurred()); if (!(st->elementpath_obj = PyImport_ImportModule("xml.etree.ElementPath"))) return NULL; |