Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
gh-39615: Add warnings.warn() skip_file_prefixes support#100840
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| # helper to the helper for testing skip_file_prefixes. | ||
| import os | ||
| package_path = os.path.dirname(__file__) | ||
| def inner_api(message, *, stacklevel, warnings_module): | ||
| warnings_module.warn( | ||
| message, stacklevel=stacklevel, | ||
| skip_file_prefixes=(package_path,)) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,15 @@ | ||
| # Helper module for testing the skipmodules argument of warnings.warn() | ||
| # Helper module for testing stacklevel and skip_file_prefixes arguments | ||
| # of warnings.warn() | ||
| import warnings | ||
| from test.test_warnings.data import package_helper | ||
| def outer(message, stacklevel=1): | ||
| inner(message, stacklevel) | ||
| def inner(message, stacklevel=1): | ||
| warnings.warn(message, stacklevel=stacklevel) | ||
| def package(message, *, stacklevel): | ||
| package_helper.inner_api(message, stacklevel=stacklevel, | ||
| warnings_module=warnings) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| :func:`warnings.warn` now has the ability to skip stack frames based on code | ||
| filename prefix rather than only a numeric ``stacklevel`` via the new | ||
| ``skip_file_prefixes`` keyword argument. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.