← 返回首页
bpo-32424: Deprecate xml.etree.ElementTree.Element.copy() in favor of copy.copy() by GPHemsley · Pull Request #12995 · python/cpython · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

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

Merged
scoder merged 1 commit into
python:masterfrom
GPHemsley:bpo-32424-5
Sep 10, 2019
Merged

bpo-32424: Deprecate xml.etree.ElementTree.Element.copy() in favor of copy.copy()#12995
scoder merged 1 commit into
python:masterfrom
GPHemsley:bpo-32424-5

Conversation

GPHemsley commented Apr 28, 2019
edited by bedevere-bot
Loading

Copy link
Copy Markdown
Contributor

https://bugs.python.org/issue32424

Copy link
Copy Markdown
Contributor Author

@scoder @serhiy-storchaka Does this match expectations?

Comment thread Lib/test/test_xml_etree.py Show resolved Hide resolved
"""
warnings.warn(
"elem.copy() is deprecated. Use copy.copy(elem) instead.",
DeprecationWarning

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

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

GPHemsley May 11, 2019
edited
Loading

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

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.

Copy link
Copy Markdown
Contributor Author

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

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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

Footer

© 2026 GitHub, Inc.