-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Confusing behavior with raise Class
#4897
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Could you describe in English what you think is wrong and what you would
expect instead? It's a rather long example to try and understand.
|
Here's a really short repro:
mypy seems to not realize that |
@gvanrossum sorry, though @JelleZijlstra has basically got it. If I have a mypy does not complain if I just write |
Ah, this is definitely a bug. Do you want to give fixing it a try? |
Sure, but I could do with a pointer as to where to start. |
@bwo -- A good starting point is often to grep for the error message -- you can then see where it's called, attach a breakpoint, etc. To save you a little bit of work, you'll probably want to start with the |
The first
reveal_type
shows thatf(1)
returns aType[Foo]
;x()
does not typecheck, with the error "Exception must be derived from BaseException".The second
reveal_type
shows thatm[1]
isdef (*args: builtins.object, **kwargs: builtins.object) -> foo.Foo
.y()
typechecks.The third
reveal_type
shows thathuh
isdef (*args: builtins.object, **kwargs: builtins.object) -> foo.Foo
.z()
does not typecheck (same error asx()
).The text was updated successfully, but these errors were encountered: