GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-39615: Add warnings.warn() skip_file_prefixes support by gpshead · Pull Request #100840 · python/cpython

Conversation

@gpshead

@gpshead gpshead commented Jan 8, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

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.

  • Issue: Enhance frame handing in warnings.warn() to skip by module rather that stacklevel #39615

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@gpshead
pythongh-39615: Add warn() skip_file_prefixes= support.
c0c19a4
`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.
@gpshead gpshead added type-feature A feature request or enhancement stdlib Standard Library Python modules in the Lib/ directory labels Jan 8, 2023
@bedevere-bot bedevere-bot added the awaiting core review label Jan 8, 2023
@bedevere-bot bedevere-bot mentioned this pull request Jan 8, 2023
Enhance frame handing in warnings.warn() to skip by module rather that stacklevel #39615
Closed
@gpshead
make patchcheck deleted a blank line?
0344483
@gpshead
gpshead requested review from brettcannon and merwok January 21, 2023 03:53
@gpshead gpshead self-assigned this Jan 23, 2023
@gpshead
gpshead requested a review from Yhg1s January 25, 2023 02:53
brettcannon
brettcannon approved these changes Jan 27, 2023
View reviewed changes
Comment thread Lib/test/test_warnings/__init__.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Lib/warnings.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot added awaiting merge and removed awaiting core review labels Jan 27, 2023
merwok
merwok reviewed Jan 28, 2023
View reviewed changes
Comment thread Lib/warnings.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@gpshead
remove the new typehint.
91010c6
@gpshead
gpshead merged commit 052f53d into python:main Jan 28, 2023
@bedevere-bot bedevere-bot removed the awaiting merge label Jan 28, 2023
@gpshead
gpshead deleted the feature/warn/skip branch January 28, 2023 02:35
merwok
merwok reviewed Jan 28, 2023
View reviewed changes
Comment thread Python/_warnings.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

mdboom pushed a commit to mdboom/cpython that referenced this pull request Jan 31, 2023
@gpshead @mdboom
pythongh-39615: Add warnings.warn() skip_file_prefixes support (pytho…
1939cb0
…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.
@encukou encukou mentioned this pull request Apr 2, 2024
GH-70647: Deprecate strptime day of month parsing without a year present to avoid leap-year bugs #117107
Merged
1 task done
wimglenn added a commit to wimglenn/cpython that referenced this pull request Aug 13, 2024
@wimglenn
Skip re pkg frames in warnings
2581e10
This uses the warnings feature skip_file_prefixes added in 3.12
python#100840
@reyammer reyammer mentioned this pull request Mar 27, 2025
python: do not alter warnings' filter google/magika#1017
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@merwok merwok merwok left review comments
@brettcannon brettcannon brettcannon approved these changes
@Yhg1s Yhg1s Awaiting requested review from Yhg1s

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@gpshead gpshead

Labels

stdlib Standard Library Python modules in the Lib/ directory type-feature A feature request or enhancement

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@gpshead @brettcannon @merwok @bedevere-bot
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.