-
Notifications
You must be signed in to change notification settings - Fork 13
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
Subclasses of Twisted's protocol fail to be determined by mypy-zope #34
Comments
@clokep two questions:
|
Nope! $ rm -r .mypy_cache
$ mypy temp.py
temp.py:6: note: Revealed type is 'def () -> temp.Foo'
$ mypy temp.py
temp.py:3: error: Cannot determine consistent method resolution order (MRO) for "Foo" [misc]
temp.py:6: note: Revealed type is 'def () -> temp.Foo'
Found 1 error in 1 file (checked 1 source file)
I don't think so, but I've never used this before so I'm not 100% sure I'm using it properly. |
I should also mention the versions of mypy I'm using: mypy==0.812 This is with the latest Twisted (Twisted==21.2.0). |
Ok, then I think I'm observing the same problem in my project. We mainly use dmypy so this doesn't annoy us very much and we learned to ignore it. Maybe it is time to figure it out. |
I had completely forgotten dmypy existed until you mentioned it!
I'd appreciate it. Please let me know if I can help at all! 😄 |
Any idea where one would start poking at to try to fix this? Does mypy-zope do something in particular to hook into the caching mechanism? |
This might be a bit tricky. I think the reason we are getting this error is because of this hack: we are adding interface class to the MRO of all implementation classes in order for this assignment to work:
mypy will consider But at the same time, I believe having this interface in the MRO list confuses up the MRO calculation in some cases (makes the inheritance graph unsortable, or smth like that). I'm not yet sure how to address that, but perhaps we need to find another way to support |
This is hopefully fixed by #41, that at least fixes the example given in the description. |
Thanks for making mypy-zope! We've been using it for Synapse (which uses Twisted) and ran into a hiccup.
The following will cause mypy-zope to emit an error:
The class hierarchy looks like
Foo
->Protocol
(which implementsIProtocol
andILoggingContext
) ->BaseProtocol
.I tried to create a reduced test-case for this, but was not able to, so it might be specific to something Twisted has done. Any help would be appreciated!
The text was updated successfully, but these errors were encountered: