-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
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
gh-129502: Fix handling errors in ctypes callbacks #129504
gh-129502: Fix handling errors in ctypes callbacks #129504
Conversation
Unlikely errors in preparing arguments for ctypes callback are now handled in the same way as errors raised in the callback of in converting the result of the callback -- using sys.unraisablehook() instead of sys.excepthook() and not setting sys.last_exc and other variables.
It is difficult to create tests for these changes, because the way to trigger such errors is memory allocation failure. If there is other way, I don't know about it (I did not dig very deep). |
Co-authored-by: Victor Stinner <vstinner@python.org>
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.
LGTM
Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13. |
…9504) Unlikely errors in preparing arguments for ctypes callback are now handled in the same way as errors raised in the callback of in converting the result of the callback -- using sys.unraisablehook() instead of sys.excepthook() and not setting sys.last_exc and other variables. (cherry picked from commit 9d63ae5) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
GH-129517 is a backport of this pull request to the 3.13 branch. |
Sorry, @serhiy-storchaka, I could not cleanly backport this to
|
…#129517) gh-129502: Fix handling errors in ctypes callbacks (GH-129504) Unlikely errors in preparing arguments for ctypes callback are now handled in the same way as errors raised in the callback of in converting the result of the callback -- using sys.unraisablehook() instead of sys.excepthook() and not setting sys.last_exc and other variables. (cherry picked from commit 9d63ae5) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
…onGH-129504) Unlikely errors in preparing arguments for ctypes callback are now handled in the same way as errors raised in the callback of in converting the result of the callback -- using sys.unraisablehook() instead of sys.excepthook() and not setting sys.last_exc and other variables. (cherry picked from commit 9d63ae5) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
GH-129639 is a backport of this pull request to the 3.12 branch. |
…#129639) Unlikely errors in preparing arguments for ctypes callback are now handled in the same way as errors raised in the callback of in converting the result of the callback -- using sys.unraisablehook() instead of sys.excepthook() and not setting sys.last_exc and other variables. (cherry picked from commit 9d63ae5)
…9504) Unlikely errors in preparing arguments for ctypes callback are now handled in the same way as errors raised in the callback of in converting the result of the callback -- using sys.unraisablehook() instead of sys.excepthook() and not setting sys.last_exc and other variables.
Unlikely errors in preparing arguments for ctypes callback are now handled in the same way as errors raised in the callback of in converting the result of the callback -- using sys.unraisablehook() instead of sys.excepthook() and not setting sys.last_exc and other variables.