You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importattrfromtypingimportProtocol, ClassVar, AnyclassAttrsInstance(Protocol):
""" A protocol to be able to statically accept an attrs class. attr itself defines AttrsInstance but only at type checking time. """__attrs_attrs__: ClassVar[Any]
@attr.sclassFoo:
bar: str=attr.ib()
Bug Report
Program using protocol for attrs instances fails to typecheck once the mypy cache is warm.
To Reproduce
Given a virtualenv containing:
a.py:
b.py:
First try with cold cache:
Now edit b.py adding one line at the end for example:
And re-run mypy, getting error unrelated to the change!
Deleting the cache makes it work again:
Note that we also get an error if using
AttrsInstance
directly instead ofType[AttrsInstance]
:Using this b.py:
Results in this after a similar edit to b.py:
Expected Behavior
Program should still typecheck correctly with warm cache.
Actual Behavior
Program fails to typecheck. Deleting the cache and re-running works as a (slow) workaround.
Your Environment
mypy.ini
(and other config files): noneThe text was updated successfully, but these errors were encountered: