I just have two questions regarding "except Exception" or "except BaseException" as it is used e.g. by concurrent.futures.process (def _process_worker) from the stdlib.
Almost similarly, I maintain a library using this pattern to wrap/unwrap exceptions from remote Python processes to create nicely formatted tracebacks (also recursively of course if needed) at the calling python process.
Usually these exceptions are wrapped, transferred to the parent process, there is the current call stack added, then reraised as a different exception, and so on and so forth if a chain of parents exist. The outermost parent process takes care of printing the tb.
My two questions regarding PEP 654:
1) What is the right "except pattern" when ExceptionGroup is introduced for the use cases described above (remote or concurrent python processes)?
2) What is the recommended approach of printing the traceback potentially incorporating multiple tracebacks - I couldn't find it in the PEP and tracebacks are a really neat tool for error hunting.
Best Regards, Sven
On 23.02.21 01:24, Irit Katriel via Python-Dev wrote:
We would like to request feedback on PEP 654 -- Exception Groups and except*.
It proposes language extensions that allow programs to raise and handle multiple unrelated exceptions simultaneously, motivated by the needs of asyncio and other concurrency libraries, but with other use cases as well.
- A new standard exception type, ExceptionGroup, to represent multiple
exceptions with shared traceback.
- Updates to the traceback printing code to display (possibly nested)
- A new syntax except* for handling ExceptionGroups.
A reference implementation (unreviewed) can be found at: https://github.com/iritkatriel/cpython/pull/10 https://github.com/iritkatriel/cpython/pull/10
Thank you for your help
Kind regards Irit, Yury & Guido
Python-Dev mailing list -- firstname.lastname@example.org To unsubscribe send an email to email@example.com https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://firstname.lastname@example.org/message/L5Q27DVK... Code of Conduct: http://python.org/psf/codeofconduct/