-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
bpo-36370: Check for PyErr_Occurred() after PyImport_GetModule(). (GH-12504) #12504
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check also calls of PyImport_GetModule() and _PyImport_GetModuleId() in other files.
|
Thanks for taking a look, I've added two more files. There's one additional place in |
|
Retracting the FUD about This PR should be complete now. |
|
I can confirm this fixes the crash I reported. |
Python/pylifecycle.c
Outdated
| PyErr_Clear(); | ||
| if (PyErr_Occurred()) { | ||
| /* unrecoverable error */ | ||
| PyErr_Clear(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should not we call PyErr_WriteUnraisable()?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe, I updated the PR now because it's used in other places as well.
But PyErr_WriteUnraisable() contains a lot of code that could fail again; I'd be more comfortable in general with PyErr_Clear() and a simple fprintf().
On the other hand, in this particular case (thread finalization) stack exhaustion shouldn't be a problem.
|
I was amazed how fast you had found the cause of the original bug. |
|
@serhiy-storchaka did you want to commit this? |
|
@skrah can do this himself. |
|
Thanks everyone for the reviews and thanks @asmeurer for testing! |
|
Thanks @skrah for the PR 🌮🎉.. I'm working now to backport this PR to: 3.7. |
|
GH-12539 is a backport of this pull request to the 3.7 branch. |
…honGH-12504) (cherry picked from commit 027b09c) Co-authored-by: Stefan Krah <skrah@bytereef.org>
|
Thank you for the quick fix on this. |
https://bugs.python.org/issue36370