Shoobx / mypy-zope

Plugin for mypy to support zope.interface
MIT License
38 stars 11 forks source link

Caching errors with latest version of mypy #76

Closed euresti closed 1 year ago

euresti commented 2 years ago

Hi. With the latest version of mypy and mypy-zope we're getting mypy errors that I think are cache related. The error goes away after rm -rf .mypy_cache

Here's the smallest repro I could make:

src/zg/foo.py:

from zg.bar import ZGScriptProtocol

print(ZGScriptProtocol.transport)

src/zg/bar.py:

from twisted.internet.protocol import ProcessProtocol

class ZGScriptProtocol(ProcessProtocol):
    pass

I am able to reliably hit the problem by running the following commands:

$ rm -rf .mypy_cache
$ mypy src/zg/foo.py 
Success: no issues found in 1 source file
$ mypy src/zg/foo.py src/zg/bar.py 
src/zg/bar.py:3: error: Cannot determine consistent method resolution order (MRO) for "ZGScriptProtocol"
src/zg/foo.py:3: error: "Type[ZGScriptProtocol]" has no attribute "transport"
$ mypy --version
mypy 0.971 (compiled: yes)

mypy-zope==0.3.9 and twisted[tls]==22.4.0

kedder commented 2 years ago

Thanks for the reproducible case, I'll try to look into it.