From b1d590815b47a63d555ecffa30f1133f774d8d54 Mon Sep 17 00:00:00 2001 From: "Gordon P. Hemsley" Date: Wed, 27 Dec 2017 10:16:46 -0500 Subject: [PATCH] bpo-32424: Rename copy() to __copy__() in Python version of xml.etree.ElementTree. The C version defines __copy__() and __deepcopy__() while the Python version defines copy(). The documentation does not mention copy(), so it is presumed to be in error. This unifies the definition of __copy__() between the Python and C version, making the proper way to copy an Element be copy.copy(ET.Element("foo")). --- Lib/xml/etree/ElementTree.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/xml/etree/ElementTree.py b/Lib/xml/etree/ElementTree.py index 87277045b525bb..5eb83bb054dd7c 100644 --- a/Lib/xml/etree/ElementTree.py +++ b/Lib/xml/etree/ElementTree.py @@ -189,7 +189,7 @@ def makeelement(self, tag, attrib): """ return self.__class__(tag, attrib) - def copy(self): + def __copy__(self): """Return copy of current element. This creates a shallow copy. Subelements will be shared with the