-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Mypy Deamon crash on second run #14098
Comments
Thanks for reporting! Hard to figure out without a repro. From the stacktrace I suspect it's something to do with namedtuples, in case that helps narrow things down. You could try installing mypy master and seeing if it repros. Once you've installed mypy master you could also put in a breakpoint and see exactly what class definition it's struggling with. |
Hi! Yes I know, without code this is almost nonsense. Thanks for the suggestion, as soon as I can I will install mypy master and try to debug! I will report back if I find something. |
I have a repro
crashes with the same traceback (in cached mode). Although @ivan94fi please still check your code, maybe you have a different scenario. If it is the same, I think I have a simple fix for this crash, similar to what @Michael0x2a did for TypedDicts. |
Hi everyone, I tested mypy master and I can reproduce the crash. However I noticed that the crash only happens when using the dmypy daemon, non when running mypy directly (both for the master and the 0.982 version). I tried to put a breakpoint in the affected code but I always get a I tried to put a breakpoint in the following files, in many places, but I always got the above behaviour:
Can someone suggest me where to put a breakpoint? Thank you. |
You should try putting a breakpoint before this line https://github.com/python/mypy/blob/master/mypy/server/astmerge.py#L393 (also maybe try using |
Ok I will try as soon as possible, thank you. By the way, I used |
Hi I managed to track down the file that was causing the issue and it has the same exact structure of the example reported by @ilevkivskyi 3 comments back, that is, a from typing import Dict, NamedTuple, List
# Class and attributes names are changed, the structure is identical to the one in the original code
class A(NamedTuple):
a: List[str]
b: Dict
c: str
d: List[str]
class AInner:
e = False It is interesting to note that executing mypy (both daemon and cli) on the above code, does not make mypy crash but it returns an error: However removing this code from the original project where it provoked a mypy crash, makes mypy stop crashing. |
OK, thanks for confirming! I will try to find time for this in coming days (unless someone else does it first). |
Crash Report
I saw this crash when using Mypy extension for VS Code, but it is reproducible in my code base even from command line by directly invoking
dmypy
as a module. The crash is in two phases:Found 238 errors in 46 files (checked 1125 source files)
, then the deamon exits (I don't know if exiting in this situation is the expected behaviour).Each time I run the command, these two phases alternate.
Traceback
To Reproduce
Unfortunately I cannot share code for now, I will try to make a reproducible example later. For now I post this error to see if someone can direct me to further steps to better understand the root of the problem or point out trivial mistakes or misconfigurations.
Your Environment
mypy.ini
(and other config files):The text was updated successfully, but these errors were encountered: