FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-102828: emit deprecation warning for onerror arg to shutil.rmtree by iritkatriel · Pull Request #102850 · python/cpython · GitHub

/ cpython Public

gh-102828: emit deprecation warning for onerror arg to shutil.rmtree - #102850

Merged
iritkatriel merged 3 commits into
python:mainfrom
iritkatriel:deprecationwarning
Mar 21, 2023
Merged

gh-102828: emit deprecation warning for onerror arg to shutil.rmtree#102850
iritkatriel merged 3 commits into
python:mainfrom
iritkatriel:deprecationwarning

Conversation

iritkatriel commented Mar 20, 2023
edited by bedevere-bot
Loading

Copy link
Copy Markdown
Member

I've asked on discord and was told that we normally emit the deprecation warning as soon as something is deprecated.

Comment thread Lib/shutil.py Outdated
"""

if onerror is not None:
warnings.warn("onerror is deprecated, use onexc instead",

giampaolo Mar 20, 2023
edited
Loading

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

I would rephrase this as "onerror argument is deprecated, use onexc instead" (emphasys on the fact that onerror is an argument)

Comment thread Lib/shutil.py Outdated
iritkatriel merged commit 7f760c2 into python:main Mar 21, 2023
Fidget-Spinner pushed a commit to Fidget-Spinner/cpython that referenced this pull request Mar 27, 2023
iritkatriel deleted the deprecationwarning branch April 3, 2023 17:42
Comment thread Lib/shutil.py
"""

if onerror is not None:
warnings.warn("onerror argument is deprecated, use onexc instead",

Copy link
Copy Markdown

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

The warn call needs stacklevel=2 parameter so that the warning message shows what is making the deprecated call. Werkzeug's tests started failing on the latest 3.12 alpha because of this, and it's really hard to tell what's causing it (I think it's pytest) because the warning just points at this line right now instead of the caller.

Copy link
Copy Markdown
Member 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

Thanks, will fix.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL