FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-128384: Use contextvar for catch_warnings() by nascheme · Pull Request #128463 · python/cpython · GitHub

/ cpython Public

gh-128384: Use contextvar for catch_warnings() - #128463

Closed
nascheme wants to merge 4 commits into
python:mainfrom
nascheme:catch_warnings_contextvar
Closed

gh-128384: Use contextvar for catch_warnings()#128463
nascheme wants to merge 4 commits into
python:mainfrom
nascheme:catch_warnings_contextvar

Conversation

nascheme commented Jan 3, 2025
edited by github-actions Bot
Loading

Copy link
Copy Markdown
Member

This changes warnings.catch_warnings() to use a contextvar for the new list of filters. If catch_warnings is not used, the list of filters is the module global warnings.filters. When the context manager is active, the effective list of filters is warnings.get_context()._filters.

This change is on top of two other unmerged PRs:


📚 Documentation preview 📚: https://cpython-previews--128463.org.readthedocs.build/

By default, inherit the context from the thread calling
`Thread.start()`.
Expose the mutex from _warnings.c and hold it when mutating the filters
list or the filters version.

Copy link
Copy Markdown
Member Author

Implemented in GH-130010.

nascheme closed this Apr 28, 2025
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant


Back | FazBrowse Home | New Git URL