nvda
073e3fa9 - Make logging of exception which occurred on non main thread less verbose (#16074)

Commit
2 years ago
Make logging of exception which occurred on non main thread less verbose (#16074) Fixes #16070 Summary of the issue: To log unhandled exceptions NVDA relies on a custom except hook installed when initializing logging. Until Python 3.8 custom except hooks were not called for exception which occurred outside of the main thread - they were simply written to stderr (see python/cpython#42148). This worked well for NVDA, since it replaces stderr with a custom object which logs everything written to stderr, so the exceptions ended up in our log, just in a different way. In Python 3.8 it become possible to install a custom hook which gets called for exceptions which are raised in non main threads, but as part of this change the way in which they are handled by default has changed - the traceback is written to stderr line by line, rather than as a single call to print as it used to be. For NVDA it means that each line of the traceback results in a separate log entry making logging extremely noisy. Description of user facing changes Exception from threads different than the main one are logged in the same way as they were in NVDA 2023.3. Description of development approach A custom except hook for exception raised in threads was introduced. It logs them as an exception with additional information explaining in which thread they were raised. Testing strategy: Performed STR from #16070 - ensured that logging looks similarly to the one from 2023.3 and that single exception results in a single log entry. Known issues with p
Author
Parents
Loading