Skip to content
This repository was archived by the owner on Apr 10, 2022. It is now read-only.

Use cases for ExceptionGroups #11

Closed
iritkatriel opened this issue Nov 25, 2020 · 8 comments
Closed

Use cases for ExceptionGroups #11

iritkatriel opened this issue Nov 25, 2020 · 8 comments

Comments

@iritkatriel
Copy link
Member

I came across https://bugs.python.org/issue29980 and wanted a place to save it, hence this issue.

@gvanrossum
Copy link
Member

You can also add yourself to the nosy list.

@iritkatriel
Copy link
Member Author

Another one: https://bugs.python.org/issue40857

Here the ArithmeticError is not really related to the FileNotFoundError, so perhaps tempfile.TemporaryDirectory() should raise them both in an ExceptionGroup so the user has to deal with both.

(Note that the fix was to not raise the FileNotFoundError at all, so the issue was sidestepped).

@1st1
Copy link
Member

1st1 commented Nov 26, 2020

I came across https://bugs.python.org/issue29980 and wanted a place to save it, hence this issue.

That's an interesting and good use case.

@bluetech
Copy link

bluetech commented Jan 1, 2021

Not sure if you mean to solicit external comments, I found this repo through a trio backlink

We have a use case for an ExceptionGroup concept in pytest, wrote it up briefly here: pytest-dev/pytest#8217

Similar situation with finalizers also exists in pluggy (a library that pytest, tox and others use for implementing "hooks") but I haven't written it up.

@iritkatriel
Copy link
Member Author

Thank you @bluetech, that's a useful contribution.

@Zac-HD
Copy link

Zac-HD commented Feb 1, 2021

I'm also keen to use it in Hypothesis - we (optionally) report multiple bugs, including where a single exception can have multiple causes.

Currently we have to print the inner tracebacks, which is pretty bad for runtime usecases. It's usually OK for test runners like pytest, unittest, or Django, but assuming they end up ExceptionGroup-aware I'd expect that to work better - in particular our MultipleFailures can cause problems for debuggers as it breaks the __context__/__cause__ chain.

(I know this has been mentioned in other issues, but thought I'd comment as it's not listed in the PEP draft)

@iritkatriel
Copy link
Member Author

Thank you @Zac-HD, that's an interesting use case and not quite the same as the pytest one.

@iritkatriel
Copy link
Member Author

These have all been added to the draft.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants