summaryrefslogtreecommitdiffstats
path: root/Modules/_elementtree.c
diff options
context:
space:
mode:
authorOren Milman <orenmn@gmail.com>2017-09-12 14:39:15 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2017-09-12 14:39:15 (GMT)
commitd056818ed2ade6d28190a375d7183f4aef9caa55 (patch)
tree7d0eb2824693f01ec9c21e1db5d09730eaaeb375 /Modules/_elementtree.c
parent98758bc67fb39b74bab368bef8ff3b34554c77c8 (diff)
downloadcpython-d056818ed2ade6d28190a375d7183f4aef9caa55.zip
cpython-d056818ed2ade6d28190a375d7183f4aef9caa55.tar.gz
cpython-d056818ed2ade6d28190a375d7183f4aef9caa55.tar.bz2
bpo-31428: Prevent raising a SystemError in case the memo arg of ElementTree.Element.__deepcopy__() isn't a dictionary. (#3512)
Diffstat (limited to 'Modules/_elementtree.c')
-rw-r--r--Modules/_elementtree.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c
index 857005a..98d5e7f 100644
--- a/Modules/_elementtree.c
+++ b/Modules/_elementtree.c
@@ -733,14 +733,14 @@ LOCAL(PyObject *) deepcopy(PyObject *, PyObject *);
/*[clinic input]
_elementtree.Element.__deepcopy__
- memo: object
+ memo: object(subclass_of="&PyDict_Type")
/
[clinic start generated code]*/
static PyObject *
-_elementtree_Element___deepcopy__(ElementObject *self, PyObject *memo)
-/*[clinic end generated code: output=d1f19851d17bf239 input=df24c2b602430b77]*/
+_elementtree_Element___deepcopy___impl(ElementObject *self, PyObject *memo)
+/*[clinic end generated code: output=eefc3df50465b642 input=a2d40348c0aade10]*/
{
Py_ssize_t i;
ElementObject* element;
@@ -849,7 +849,8 @@ deepcopy(PyObject *object, PyObject *memo)
/* Fall through to general case */
}
else if (Element_CheckExact(object)) {
- return _elementtree_Element___deepcopy__((ElementObject *)object, memo);
+ return _elementtree_Element___deepcopy___impl(
+ (ElementObject *)object, memo);
}
}