-
-
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
Handling errors in ctypes callbacks #129502
Labels
extension-modules
C modules in the Modules dir
topic-ctypes
type-bug
An unexpected behavior, bug, or error
Comments
serhiy-storchaka
added a commit
to serhiy-storchaka/cpython
that referenced
this issue
Jan 31, 2025
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.
serhiy-storchaka
added a commit
that referenced
this issue
Jan 31, 2025
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.
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this issue
Jan 31, 2025
…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 <[email protected]>
Yhg1s
pushed a commit
that referenced
this issue
Feb 4, 2025
…#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 <[email protected]>
serhiy-storchaka
added a commit
to serhiy-storchaka/cpython
that referenced
this issue
Feb 4, 2025
…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 <[email protected]>
Yhg1s
pushed a commit
that referenced
this issue
Feb 4, 2025
…#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)
Triage: PR merged and backported. Please re-open if there's more to do. |
srinivasreddy
pushed a commit
to srinivasreddy/cpython
that referenced
this issue
Feb 7, 2025
…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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
extension-modules
C modules in the Modules dir
topic-ctypes
type-bug
An unexpected behavior, bug, or error
If an error happens in the callback or in converting result of the callback, it is handled by calling
PyErr_FormatUnraisable()
. If an error happens in preparing arguments for the callback, it is handled in different way -- some message is printed to stderr and thenPyErr_Print()
is called. In one case the error is not properly handled.It is better to handle all errors in the uniform way.
PyErr_Print()
is not suitable for it because it treats SystemExit specially and has a side effect of setting sys.last_exc` and other variables.Linked PRs
The text was updated successfully, but these errors were encountered: