gh-102828: emit deprecation warning for onerror arg to shutil.rmtree#102850
Merged
iritkatriel merged 3 commits intopython:mainfrom Mar 21, 2023
Merged
gh-102828: emit deprecation warning for onerror arg to shutil.rmtree#102850iritkatriel merged 3 commits intopython:mainfrom
iritkatriel merged 3 commits intopython:mainfrom
Conversation
giampaolo
reviewed
Mar 20, 2023
Lib/shutil.py
Outdated
| """ | ||
|
|
||
| if onerror is not None: | ||
| warnings.warn("onerror is deprecated, use onexc instead", |
Contributor
There was a problem hiding this comment.
I would rephrase this as "onerror argument is deprecated, use onexc instead" (emphasys on the fact that onerror is an argument)
iritkatriel
commented
Mar 20, 2023
Fidget-Spinner
pushed a commit
to Fidget-Spinner/cpython
that referenced
this pull request
Mar 27, 2023
davidism
reviewed
Apr 10, 2023
| """ | ||
|
|
||
| if onerror is not None: | ||
| warnings.warn("onerror argument is deprecated, use onexc instead", |
There was a problem hiding this comment.
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.
iritkatriel
added a commit
to iritkatriel/cpython
that referenced
this pull request
Apr 10, 2023
warsaw
pushed a commit
to warsaw/cpython
that referenced
this pull request
Apr 11, 2023
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I've asked on discord and was told that we normally emit the deprecation warning as soon as something is deprecated.