Skip to content

gh-39615: Add warnings.warn() skip_file_prefixes support - #100840

Merged
gpshead merged 3 commits into
python:mainfrom
gpshead:feature/warn/skip
Jan 28, 2023
Merged

gh-39615: Add warnings.warn() skip_file_prefixes support#100840
gpshead merged 3 commits into
python:mainfrom
gpshead:feature/warn/skip

Conversation

@gpshead

@gpsheadgpshead commented Jan 8, 2023

Copy link
Copy Markdown
Member

warnings.warn() gains the ability to skip stack frames based on code filename prefix rather than only a numeric stacklevel= via a new skip_file_prefixes= keyword argument.

My motivation work finally tackling this feature: It will avoid the hacks around putting the warning in the right place in #100618.

`warnings.warn()` gains the ability to skip stack frames based on code
filename prefix rather than only a numeric `stacklevel=` via a new
`skip_file_prefixes=` keyword argument.
@gpsheadgpshead added type-feature A feature request or enhancement stdlib Standard Library Python modules in the Lib/ directory labels Jan 8, 2023
@gpsheadgpshead self-assigned this Jan 23, 2023
@gpshead
gpshead requested a review from Yhg1sJanuary 25, 2023 02:53
Comment threadLib/test/test_warnings/__init__.py
Comment threadLib/warnings.py Outdated
Comment threadLib/warnings.py Outdated
@gpshead
gpshead merged commit 052f53d into python:mainJan 28, 2023
@gpshead
gpshead deleted the feature/warn/skip branch January 28, 2023 02:35
Comment threadPython/_warnings.c
mdboom pushed a commit to mdboom/cpython that referenced this pull request Jan 31, 2023
…n#100840)
`warnings.warn()` gains the ability to skip stack frames based on code
filename prefix rather than only a numeric `stacklevel=` via a new
`skip_file_prefixes=` keyword argument.
wimglenn added a commit to wimglenn/cpython that referenced this pull request Aug 13, 2024
This uses the warnings feature skip_file_prefixes added in 3.12
python#100840
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@gpshead@brettcannon@merwok@bedevere-bot