GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [WIP] gh-73858: Save and restore module warning registries in catch_warnings by segevfiner · Pull Request #8232 · python/cpython

Conversation

@segevfiner

@segevfiner segevfiner commented Jul 10, 2018 •
edited by serhiy-storchaka
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

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

  • Issue: catch_warnings context manager causes all warnings to be printed every time, even after exiting #73858

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

gerritholl, suic86, SiegeLordEx, jni, anmyachev, calgray, and btmills reacted with thumbs up emoji
All reactions
  • 👍 7 reactions
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label Jul 10, 2018
@bedevere-bot bedevere-bot added the awaiting review label Jul 10, 2018
@segevfiner
bpo-29672: Save and restore module warning registries in catch_warnings
64ceef9
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
@gerritholl
Prevent entering catch_warnings
c41a7e2
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
@gerritholl gerritholl mentioned this pull request Oct 12, 2018
Prevent entering catch_warnings FIDUCEO/FCDR_HIRS#301
Merged
ZackerySpytz
ZackerySpytz reviewed Nov 29, 2018
View reviewed changes
Comment thread Python/_warnings.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

@segevfiner
Py_XDECREF to Py_DEC_REF
f5a82a4
@gerritholl gerritholl mentioned this pull request Feb 25, 2021
Enable showing DeprecationWarning in debug_on and add unit test pytroll/satpy#1554
Merged
3 tasks done
@patnr

patnr commented Mar 4, 2021

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

segevfiner added 3 commits February 21, 2022 11:52
@segevfiner
Merge remote-tracking branch 'upstream/main' into bpo-29672-catch-war…
c08c701
…nings-registries-restore
@segevfiner
Fix build
19bac0e
@segevfiner
Fix another issue introduced by the merge
d6217a4
@ezio-melotti ezio-melotti removed the CLA signed label Jul 13, 2022
@gerritholl gerritholl mannequin mentioned this pull request Nov 2, 2022
catch_warnings context manager causes all warnings to be printed every time, even after exiting #73858
Open
@Carreau Carreau mentioned this pull request Sep 26, 2023
MAINT: Use scipy builtins rotation to compute quaternions. napari/napari#6241
Merged
@Czaki Czaki mentioned this pull request Oct 27, 2023
Do not repeat warnings in GUI napari/napari#6396
Merged
@jrmylow jrmylow mentioned this pull request Nov 3, 2023
BUG: Creating a pandas.DataFrame affects warnings filters pandas-dev/pandas#55801
Open
2 of 3 tasks
@anmyachev

anmyachev commented Nov 4, 2023

Copy link
Copy Markdown

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@segevfiner

segevfiner commented Nov 13, 2023

Copy link
Copy Markdown
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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@serhiy-storchaka
serhiy-storchaka marked this pull request as draft January 17, 2024 20:07
@bedevere-app bedevere-app Bot removed the awaiting review label Jan 17, 2024
@rhshadrach

rhshadrach commented Jan 24, 2024

Copy link
Copy Markdown

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?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions

github-actions Bot commented Sep 21, 2024

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Sep 21, 2024
@StrawberryOwl StrawberryOwl mentioned this pull request Feb 3, 2025
BUG: Pandas resets counter when using filterwarning "once" pandas-dev/pandas#60664
Closed
2 of 3 tasks
@serhiy-storchaka serhiy-storchaka changed the title [WIP] bpo-29672: Save and restore module warning registries in catch_warnings [WIP] gh-73858: Save and restore module warning registries in catch_warnings Aug 12, 2026
@github-actions github-actions Bot removed the stale Stale PR or inactive for long period of time. label Aug 13, 2026
@ambv

ambv commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

This PR is blocked on its author, has not been touched by a human in more than 2 years, and no longer merges cleanly. Closing to cull the number of open pull requests. Do not reopen this pull request without getting a go-ahead from a triager or core developer on gh-73858.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ambv ambv closed this Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@ericsnowcurrently ericsnowcurrently Awaiting requested review from ericsnowcurrently ericsnowcurrently will be requested when the pull request is marked ready for review ericsnowcurrently is a code owner
1 more reviewer
@ZackerySpytz ZackerySpytz ZackerySpytz left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

9 participants

@segevfiner @patnr @anmyachev @rhshadrach @ambv @ZackerySpytz @the-knights-who-say-ni @ezio-melotti @bedevere-bot
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.