diff options
author | Gordon P. Hemsley <me@gphemsley.org> | 2019-09-10 15:22:01 (GMT) |
---|---|---|
committer | Stefan Behnel <stefan_ml@behnel.de> | 2019-09-10 15:22:01 (GMT) |
commit | 7d952ded6813c896ea3f4234bb8db5247dcb5484 (patch) | |
tree | 15472d3858af207919e4893b1335d99d08974616 /Lib/xml | |
parent | a9b6033179b64b985394ad351501089a6a94fc9d (diff) | |
download | cpython-7d952ded6813c896ea3f4234bb8db5247dcb5484.zip cpython-7d952ded6813c896ea3f4234bb8db5247dcb5484.tar.gz cpython-7d952ded6813c896ea3f4234bb8db5247dcb5484.tar.bz2 |
bpo-32424: Deprecate xml.etree.ElementTree.Element.copy() in favor of copy.copy() (GH-12995)
Diffstat (limited to 'Lib/xml')
-rw-r--r-- | Lib/xml/etree/ElementTree.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/xml/etree/ElementTree.py b/Lib/xml/etree/ElementTree.py index e75200a..c8d898f 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 |