You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When initializing a BaseExceptionGroup with non-base exceptions the stdlib (and the backport) will in fact return an ExceptionGroup. The typing in neither of typeshed nor the backport currently supports this.
$ python foo.py
Runtime type is 'ExceptionGroup'
$ mypy foo.py
foo.py:30: note: Revealed type is "builtins.BaseExceptionGroup[builtins.ValueError]"
$ pyright foo.py
foo.py
foo.py:30:13 - information: Type of "x" is "BaseExceptionGroup[ValueError]"
I have vague recollections that trying to do this was hard-to-impossible, but I currently cannot find any related issues.
The text was updated successfully, but these errors were encountered:
At a glance it seems like an overloaded __new__ might work, similar to what's done with some of the other BaseExceptionGroup methods. Though given how special __new__ is, I suspect there may be some unique complications
(cc @sobolevn as the author of the current BaseExceptionGroup overloads)
When initializing a
BaseExceptionGroup
with non-base exceptions the stdlib (and the backport) will in fact return anExceptionGroup
. The typing in neither of typeshed nor the backport currently supports this.I have vague recollections that trying to do this was hard-to-impossible, but I currently cannot find any related issues.
The text was updated successfully, but these errors were encountered: