From 7d952ded6813c896ea3f4234bb8db5247dcb5484 Mon Sep 17 00:00:00 2001 From: "Gordon P. Hemsley" Date: Tue, 10 Sep 2019 11:22:01 -0400 Subject: bpo-32424: Deprecate xml.etree.ElementTree.Element.copy() in favor of copy.copy() (GH-12995) --- Lib/xml/etree/ElementTree.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'Lib/xml/etree/ElementTree.py') diff --git a/Lib/xml/etree/ElementTree.py b/Lib/xml/etree/ElementTree.py index e75200a1b8..c8d898f328 100644 --- a/Lib/xml/etree/ElementTree.py +++ b/Lib/xml/etree/ElementTree.py @@ -195,6 +195,13 @@ class Element: original tree. """ + warnings.warn( + "elem.copy() is deprecated. Use copy.copy(elem) instead.", + DeprecationWarning + ) + return self.__copy__() + + def __copy__(self): elem = self.makeelement(self.tag, self.attrib) elem.text = self.text elem.tail = self.tail -- cgit v1.2.1