summaryrefslogtreecommitdiffstats
path: root/Modules/_elementtree.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-07-10 20:28:02 (GMT)
committerGitHub <noreply@github.com>2017-07-10 20:28:02 (GMT)
commitb136f11f3a51f9282ae992bac68f170ca5563b55 (patch)
treefbfce2b0b7ef241086922063b3d755ace9adb5cf /Modules/_elementtree.c
parentaa8d0a24694bea05061f1920ec3f944a9e6799d5 (diff)
downloadcpython-b136f11f3a51f9282ae992bac68f170ca5563b55.zip
cpython-b136f11f3a51f9282ae992bac68f170ca5563b55.tar.gz
cpython-b136f11f3a51f9282ae992bac68f170ca5563b55.tar.bz2
bpo-30892: Fix _elementtree module initialization (#2647)
Handle getattr(copy, 'deepcopy') error in _elementtree module initialization.
Diffstat (limited to 'Modules/_elementtree.c')
-rw-r--r--Modules/_elementtree.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c
index eaa9e87..3537f19 100644
--- a/Modules/_elementtree.c
+++ b/Modules/_elementtree.c
@@ -3990,6 +3990,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;