Skip to content

Conversation

nascheme
Copy link
Member

@nascheme nascheme commented Jan 3, 2025

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.
@nascheme
Copy link
Member Author

Implemented in GH-130010.

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