Skip to content

bpo-46025: Fix a crash in the atexit module for auto-unregistering functions - #30002

Merged
pablogsal merged 3 commits into
python:mainfrom
pablogsal:bpo-46025
Dec 9, 2021
Merged

pablogsal merged 3 commits into
python:mainfrom
pablogsal:bpo-46025

Conversation

@pablogsal

@pablogsal pablogsal commented Dec 9, 2021 •

Copy link
Copy Markdown
Member
Comment thread Modules/atexitmodule.c Resolved
Comment thread Lib/test/_test_atexit.py Resolved
Comment thread Modules/atexitmodule.c Resolved
pablogsal and others added 2 commits December 9, 2021 13:16
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Christian Heimes <christian@python.org>

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks, I'm feeling more confident with catch_unraisable_exception.

I'm surprised that no other atexit uses catch_unraisable_exception.

Comment thread Lib/test/_test_atexit.py
atexit._run_exitfuncs()
self.assertEqual(cm.unraisable.object, func)
self.assertEqual(cm.unraisable.exc_type, ZeroDivisionError)
self.assertEqual(type(cm.unraisable.exc_value), ZeroDivisionError)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if checking exc_value is needed, but it's ok to test it :-)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes it a military-grade test :)

@miss-islington

Copy link
Copy Markdown
Contributor

@pablogsal: Status check is done, and it's a failure ❌ .

1 similar comment
@miss-islington

Copy link
Copy Markdown
Contributor

@pablogsal: Status check is done, and it's a failure ❌ .

@pablogsal
pablogsal merged commit f0d290d into python:main Dec 9, 2021
@pablogsal
pablogsal deleted the bpo-46025 branch December 9, 2021 13:53
@miss-islington

Copy link
Copy Markdown
Contributor

Thanks @pablogsal for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10.
🐍🍒⛏🤖

@bedevere-bot

Copy link
Copy Markdown

GH-30005 is a backport of this pull request to the 3.10 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Dec 9, 2021
…nctions (pythonGH-30002)

(cherry picked from commit f0d290d)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
pablogsal added a commit that referenced this pull request Dec 9, 2021
…nctions (GH-30002) (GH-30005)

(cherry picked from commit f0d290d)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
@vstinner

vstinner commented Dec 9, 2021

Copy link
Copy Markdown
Member

Thanks for the fix ;-)

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

Labels

None yet

6 participants