nvda
247c9742 - Add custom hooks for unraisable exceptions, to log exceptions raised in ctypes callback functions in a more readable way (#16169)

Commit
2 years ago
Add custom hooks for unraisable exceptions, to log exceptions raised in ctypes callback functions in a more readable way (#16169) Fixes #16115 Summary of the issue: When an exception is raised in ctypes callback function Python cannot handle it in any reasonable way, so the traceback gets printed to stderr. Somewhere after Python 3.7 a change was made, so that it is printed line by line. As a result we get as many log entries as there were lines in the traceback making logging extremely noisy. Description of user facing changes Exceptions from ctypes callback functions once again results in a single log entry. Description of development approach Since Python 3.8 it is possible to customize how these so called unraisable exceptions are handle. This PR adds a handler which logs them in a readable format, mostly based on how the native Python's hook does this.
Author
Parents
Loading