mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
bpo-32424: Deprecate xml.etree.ElementTree.Element.copy() in favor of copy.copy() (GH-12995)
This commit is contained in:
parent
a9b6033179
commit
7d952ded68
3 changed files with 39 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue