peps icon indicating copy to clipboard operation
peps copied to clipboard

PEP 785: address comments and partially revise proposal

Open Zac-HD opened this issue 4 months ago • 0 comments

Thanks in particular to @.iritkatriel for great feedback on Discourse, and @.gpshead for discussions over lunch.

This update makes a moderate change to the proposed BaseExceptionGroup.leaf_exceptions() method, to return a list of (exc, traceback) tuples rather than accepting a boolean flag to call .with_traceback() for the user, and to specify that each sub-exception must be processed only once (in rare cases where a group is not tree-structured).

The larger change is to scrap my proposed BaseException.preserve_context() method: since I'd only (but always) recommend using it in the specific case of re-raising part of the exception group rendered by an except* statement, I now propose that we make a small language change to 'do the right thing' there unconditionally.

Discuss thread here.


📚 Documentation preview 📚: https://pep-previews--4568.org.readthedocs.build/

Zac-HD avatar Aug 29 '25 23:08 Zac-HD