-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Nested class in Protocol causes mypy exception #6393
Comments
Hm, actually nested classes in protocols are not supported (also one will be able to mimic it with a protocol field when #4536 will be fixed). Anyway, we definitely should not crash. |
Thanks, the nested class was in there as a vestige of some refactoring. It took a little while to figure out what was going on because the error doesn't present when running the Protocol subclass through mypy only when you process something with a call to a function using it. So I thought it was worth fixing as other than the mention of "is_protocol_implementation" in the traceback it's not at all clear where to look for the problem. |
An even simpler repro of this problem is in #8397 |
Just checked, this still reproes, along with the reproducer in #8397
|
Fixes #6393 This is unspecified behavior in terms of PEP 544, so we just try to do something meaningful (see test case). At least we should not crash.
Are you reporting a bug, or opening a feature request?
bug
Please insert below the code you are checking with mypy,
or a mock-up repro if the source is private. We would appreciate
if you try to simplify your case to a minimal repro.
What are the versions of mypy and Python you are using?
0.670
Do you see the same issue after installing mypy from Git master?
Yes
What are the mypy flags you are using? (For example --strict-optional)
Doesn't seem to matter what flags are used, Was using defaults on https://mypy-play.net/ to produce the sample code pasted above
If mypy crashed with a traceback, please paste
the full traceback below.
The text was updated successfully, but these errors were encountered: