Skip to content

gh-149211: Preserve custom warning handler during finalization#150944

Open
iamrajhans wants to merge 1 commit into
python:mainfrom
iamrajhans:issue-149211-warnings-cleanup
Open

gh-149211: Preserve custom warning handler during finalization#150944
iamrajhans wants to merge 1 commit into
python:mainfrom
iamrajhans:issue-149211-warnings-cleanup

Conversation

@iamrajhans
Copy link
Copy Markdown
Contributor

Fixes gh-149211.

This keeps the public warnings module reachable by the _warnings accelerator during late interpreter finalization via a weak reference, so warnings.warn() can still dispatch through a custom warnings.showwarning after sys.modules cleanup.

Tests run:

  • make -j8
  • ./python.exe -m test test_warnings -m test_showwarning_during_finalization -v
  • ./python.exe -m test test_warnings
  • git diff --check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Default warnings.showwarning always used when interpreter session is cleaning up

1 participant