PEP-654 ExceptionGroup support in python<3.11

Bug #2042672 reported by John Litborn
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Apport
New
Undecided
Unassigned

Bug Description

Hello,
python3.11 introduced ExceptionGroups[1], which Apport manages to format perfectly fine on python>=3.11 - but there is a backport package[2] for python<3.11 which relies on monkeypatching sys.excepthook to reformat the exception and get it to properly print sub-exceptions. This clashes with Apport, which also monkeypatches sys.excepthook in order to collect debugging information.
I recently wrote a PR[3] to the exceptiongroup repo with a messy workaround to work with Apport, but it would be much cleaner if Apport could make use of the backport package itself - and that would also avoid issues that might arise from Apport changing its hook[4]

[1] PEP 654: https://peps.python.org/pep-0654/
[2] Backport package: https://github.com/agronholm/exceptiongroup
[3] ExceptionGroup PR: https://github.com/agronholm/exceptiongroup/pull/88
[4] Issue that arose when apport renamed its hook https://github.com/python-trio/trio/issues/2464

Issue in agronholm/exceptiongroup that discusses adaption of the backport in various packages: https://github.com/agronholm/exceptiongroup/issues/23

I might be able to write a PR that implements it and submit it to your GitHub in case you deem this valuable but low priority.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.