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
This is a rather weird bug that showed up for us in production when I tried to upgrade to 0.600. The repro requires at least four files, so I decided to put it in its own little repo: https://github.com/JelleZijlstra/tmp-mypy-bug. Running mypy baddir (with mypy 0.600) reproes the bug there.
Basically, the test case has four files that import each other (__init__ -> ba -> b -> c). ba additionally uses a name from b (defines as LOCAL_HOSTNAME = socket.gethostname()), and the usage of this name causes a "Cannot determine type" error. Various minor transformations (making LOCAL_HOSTNAME a string literal; removing c.py) make the error go away.
Interestingly, renaming ba.py to a.py (as in the gooddir in the repo) silences the bug. This suggests that this is somehow related to the alphabetical order of the files involved. The bug didn't appear in 0.590. I'm guessing it's somehow related to the various FileSystemCache changes that went into 0.600. https://github.com/python/mypy/blob/master/mypy/find_sources.py#L78 is suspicious in that it does a sort and was new in 0.600, although really I'm just guessing.
The text was updated successfully, but these errors were encountered:
This is a rather weird bug that showed up for us in production when I tried to upgrade to 0.600. The repro requires at least four files, so I decided to put it in its own little repo: https://github.com/JelleZijlstra/tmp-mypy-bug. Running
mypy baddir
(with mypy 0.600) reproes the bug there.Basically, the test case has four files that import each other (
__init__
->ba
->b
->c
).ba
additionally uses a name fromb
(defines asLOCAL_HOSTNAME = socket.gethostname()
), and the usage of this name causes a "Cannot determine type" error. Various minor transformations (makingLOCAL_HOSTNAME
a string literal; removingc.py
) make the error go away.Interestingly, renaming
ba.py
toa.py
(as in thegooddir
in the repo) silences the bug. This suggests that this is somehow related to the alphabetical order of the files involved. The bug didn't appear in 0.590. I'm guessing it's somehow related to the various FileSystemCache changes that went into 0.600. https://github.com/python/mypy/blob/master/mypy/find_sources.py#L78 is suspicious in that it does a sort and was new in 0.600, although really I'm just guessing.The text was updated successfully, but these errors were encountered: