-
-
Notifications
You must be signed in to change notification settings - Fork 36.8k
Handling errors in ctypes callbacks #129502
Copy link
Copy link
Closed
Labels
extension-modulesC modules in the Modules dirC modules in the Modules dirtopic-ctypestype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Activity
Metadata
Metadata
Assignees
Labels
extension-modulesC modules in the Modules dirC modules in the Modules dirtopic-ctypestype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Projects
- StatusShow more project fieldsDone
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