Skip to content

[WIP] bpo-29672: Save and restore module warning registries in catch_warnings #8232

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

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

segevfiner
Copy link
Contributor

@segevfiner segevfiner commented Jul 10, 2018

This avoids catch_warnings wiping 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

  • Should onceregistry be saved and restored too?
  • A better test? I'm not sure how to test this better since catch_warnings is used for the warnings tests themselves.
  • Consider the order that things are done in catch_warnings.__enter__ and catch_warnings.__exit__, to cause the least disturbance due to threads (It's not thread safe anyhow...)
  • Documentation & NEWS.d obviously

https://bugs.python.org/issue29672

This avoids catch_warnings wiping out all module warning registries due
to calling _filters_mutated. Which causes all warnings recorded in those
registries to be shown again.
@segevfiner segevfiner force-pushed the bpo-29672-catch-warnings-registries-restore branch from 041d004 to 64ceef9 Compare July 15, 2018 16:28
gerritholl added a commit to FIDUCEO/FCDR_HIRS that referenced this pull request Oct 12, 2018
Prevent entering catch_warnings so I don't get the same error printed over
and over again.  See https://bugs.python.org/issue29672 and
python/cpython#8232
@patnr
Copy link

patnr commented Mar 4, 2021

Not sure if bumping is appropriate, but here's hoping for a resolution to this soon!

Here's how I became aware of it.
https://stackoverflow.com/questions/66388579

@anmyachev
Copy link

Hi @segevfiner do you plan to continue working on this pull request? Or are you waiting for a review?

I ask because I also encountered this problem and I wonder if it can be solved in the near future.

@segevfiner
Copy link
Contributor Author

Hi @segevfiner do you plan to continue working on this pull request? Or are you waiting for a review?

I ask because I also encountered this problem and I wonder if it can be solved in the near future.

It was waiting for a full review since a long time ago (2018...), and seems to have gone stale quite a bit by now. I can try to resolve the conflicts, but even then, I'm not sure any core maintainer will review this

@serhiy-storchaka serhiy-storchaka marked this pull request as draft January 17, 2024 20:07
@rhshadrach
Copy link

but even then, I'm not sure any core maintainer will review this

I imagine this has a wide impact, we've gotten numerous issues raised in pandas. As the linked issue points out, one can hit this from the standard library too. I don't understand why it wouldn't be reviewed, but maybe there is some way we can drum up support?

Copy link

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale Stale PR or inactive for long period of time. label Sep 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Stale PR or inactive for long period of time.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants