[WIP] bpo-29672: Save and restore module warning registries in catch_warnings#8232
Uh oh!
There was an error while loading. Please reload this page.
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.
This avoids
catch_warningswiping out all module warning registries due to calling_filters_mutated. Which causes all warnings recorded in those registries to be shown again.I'm not sure if this is the right approach for this, so I'm submitting this incomplete in order to garner feedback, and for answers to the questions in TODO below.
TODO
onceregistrybe saved and restored too?catch_warningsis used for the warnings tests themselves.catch_warnings.__enter__andcatch_warnings.__exit__, to cause the least disturbance due to threads (It's not thread safe anyhow...)https://bugs.python.org/issue29672