Skip to content

Experiment with ExceptionGroup and BaseException.add_note() (in Python 3.11) #3175

Closed
@Zac-HD

Description

@Zac-HD

PEP 654 introduces a new ExceptionGroup type, which is designed to replace Trio's MultiError and our very own MultipleFailures types. There's also neat new except* syntax for handling them, but that's not our problem. Based on our conversation, Irit Katriel also added BaseException.__note__ so that we can attach our Failing example: strings (etc) to the exception objects, instead of printing them by hand.

So before Python 3.11 is released, preferably in the alphas (i.e. before May 2022), we should get this working - preferably shipped; but at least prototyped to a level that any problems can be fixed and re-tested before 3.11rc1.

Presumably at some point there will be a backports.exceptiongroup package that we can standardize on along with Trio, Pytest, and so on; but until then I'm happy to keep using our own exceptions.

Metadata

Metadata

Assignees

Labels

interophow to play nicely with other packageslegibilitymake errors helpful and Hypothesis grokable

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions