Unable to satisfy Pyright in an except (Base)ExceptionGroup clause
#10384
Mike Nerone (mikenerone)
started this conversation in
General
Replies: 2 comments 4 replies
|
Moving to discussion since this isn't a bug report but rather a question. |
4 replies
|
yes |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This is another problem stemming from #10217. Pyright reports the commented error for this code (command line - VSCode doesn't complain (yet?)):
The problem, of course, is the use of
(Base)ExceptionGroupwithout specifying the generic. Simply specifying the generic satisfies Pyright, but doesn't work at runtime:I also don't see where I can
typing.cast()something to work around this. I tried this, which again works at runtime, but elicits a different error from Pyright (and also adds new errors from a.subgroup()call further down in the real code):Is there a solution to properly typing this, or is it the intent that all
exceptclauses with a generic exception type need an ignore directive?All reactions