`warnings.deprecated` has no `skip_file_prefixes`
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 35.9k
- PR merge metrics
- PR metrics pending
Description
Feature or enhancement
Proposal:
Seems like when adding warnings.deprecated in https://github.com/python/cpython/pull/104004, it was forgotten to add one of the two stack skipping arguments.
It needs it for the same reasons why it already got stacklevel, e.g. because adding decorators adds stack levels in a hard to predict way (e.g. a 3rd party decorator might start calling the wrapped function one level deeper, suddenly changing where the warning points)
Has this already been discussed elsewhere?
Yes, and it was accepted, but then apparently fogotten, see link below
cc @brettcannon @JelleZijlstra
Links to previous discussion of this feature:
https://discuss.python.org/t/pep-702-marking-deprecations-using-the-type-system/23036/11
Linked PRs
- gh-156937
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review the implementation and tests for warnings.deprecated, starting with how stacklevel is handled and how skip_file_prefixes is represented elsewhere. The linked PR gh-156937 is the current work to inspect. Done means warnings.deprecated supports skip_file_prefixes for the stated decorator and stack-trace cases, with tests covering the behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100