Skip to content

Conversation

@picnixz
Copy link
Member

@picnixz picnixz commented Oct 23, 2024

This is the simplest implementation I could think of. Another alternative I had in mind was to specialize the code for leaf exceptions but this would need to move around some prototypes and definitions, making the diff much harder to review. One the other hand, I think we don't really need to bother about critical performances when handling exception groups so converting it into an exception group and directly calling the method on that group felt simpler.

@Zac-HD Did you maybe have a different implementation in mind? One alternative is to expose some wraps() method on exception classes which convert them into exception groups if this is not already the case, so that you have something like exc.wraps().split().

By the way, I found a small bug in an existing test where a callable predicate is not being tested. It's in test_basics_subgroup_by_predicate__match.


📚 Documentation preview 📚: https://cpython-previews--125883.org.readthedocs.build/

@Zac-HD
Copy link
Contributor

Zac-HD commented Oct 23, 2024

This is what I had in mind!

I'd rather not add .wraps() or similar because I don't think exc.wraps() is useful separately from then splitting or taking a subgroup often enough to justify a new method, when BaseExceptionGroup("", [exc]) is already pretty short.

@picnixz
Copy link
Member Author

picnixz commented Mar 30, 2025

Closing since the original issue was closed in favor of an alternative.

@picnixz picnixz closed this Mar 30, 2025
@picnixz picnixz deleted the feat/standalone-exception-group-125825 branch October 11, 2025 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants