mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-94383: Remove ElementTree.Element.copy() method (#94384)
xml.etree: Remove the ElementTree.Element.copy() method of the pure Python implementation, deprecated in Python 3.10, use the copy.copy() function instead. The C implementation of xml.etree has no copy() method, only a __copy__() method.
This commit is contained in:
parent
fbcee570d1
commit
fd76eb547d
4 changed files with 11 additions and 42 deletions
|
@ -188,19 +188,6 @@ class Element:
|
|||
"""
|
||||
return self.__class__(tag, attrib)
|
||||
|
||||
def copy(self):
|
||||
"""Return copy of current element.
|
||||
|
||||
This creates a shallow copy. Subelements will be shared with the
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue