gh-129502: Fix handling errors in ctypes callbacks#129504
gh-129502: Fix handling errors in ctypes callbacks#129504serhiy-storchaka merged 2 commits intopython:mainfrom
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>
|
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.