Thanks to visit codestin.com
Credit goes to github.com

Skip to content

bpo-32424: Deprecate xml.etree.ElementTree.Element.copy() in favor of copy.copy() #12995

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 10, 2019

Conversation

GPHemsley
Copy link
Contributor

@GPHemsley GPHemsley commented Apr 28, 2019

https://bugs.python.org/issue32424

@GPHemsley
Copy link
Contributor Author

@scoder @serhiy-storchaka Does this match expectations?

@@ -194,6 +194,13 @@ def copy(self):
original tree.

"""
warnings.warn(
"elem.copy() is deprecated. Use copy.copy(elem) instead.",
DeprecationWarning
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if we should issue a DeprecationWarning straight away (or a PendingDeprecationWarning first), although I personally wouldn't mind, given that the C implementation has shadowed this method for years (in CPython, that is).
@serhiy-storchaka, what do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, copy() does not appear in the documentation, either.

Copy link
Contributor Author

@GPHemsley GPHemsley May 11, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I can't find any record of copy ever having been available in the C implementation; it looks like it was __copy__ from the beginning.

The first appearance of copy in the Python implementation was in f15351d (first released in Python 3.1 and 2.7.4), which deemed it "experimental". 84fae78 (first released in Python 3.4) removed that designation when switching from comments to docstrings.

@GPHemsley
Copy link
Contributor Author

@serhiy-storchaka Any thoughts on this? I think your opinion is the only thing outstanding here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants