Open Redoubts opened 4 days ago
Can repro. The full exception when running dmypy as module with a fresh master checkout:
svalentin-coder-main:~/src/mypy (master)$ python -m mypy.dmypy --version
dmypy 1.14.0+dev.9e689593c9b99555631c2e2bcc05cb5481a557fb
svalentin-coder-main:~/src/mypy (master)$ touch x.py y.py
svalentin-coder-main:~/src/mypy (master)$ python -m mypy.dmypy --status-file ./dmypy.json run --timeout=86400 -- --cache-dir=/dev/null x.py
Daemon started
Success: no issues found in 1 source file
svalentin-coder-main:~/src/mypy (master)$ python -m mypy.dmypy --status-file ./dmypy.json run --timeout=86400 -- --cache-dir=/dev/null y.py
Success: no issues found in 1 source file
svalentin-coder-main:~/src/mypy (master)$ python -m mypy.dmypy --status-file ./dmypy.json run --timeout=86400 -- --cache-dir=/dev/null x.py
/home/svalentin/src/mypy/mypy/typeshed/stdlib/_codecs.pyi:12: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 1.14.0+dev.9e689593c9b99555631c2e2bcc05cb5481a557fb
/home/svalentin/src/mypy/mypy/typeshed/stdlib/_codecs.pyi:12: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 1.14.0+dev.9e689593c9b99555631c2e2bcc05cb5481a557fb
Daemon crashed!
Traceback (most recent call last):
File "/home/svalentin/src/mypy/mypy/dmypy_server.py", line 236, in serve
resp = self.run_command(command, data)
File "/home/svalentin/src/mypy/mypy/dmypy_server.py", line 285, in run_command
ret = method(self, **data)
File "/home/svalentin/src/mypy/mypy/dmypy_server.py", line 353, in cmd_run
return self.check(sources, export_types, is_tty, terminal_width)
File "/home/svalentin/src/mypy/mypy/dmypy_server.py", line 432, in check
messages = self.fine_grained_increment_follow_imports(
File "/home/svalentin/src/mypy/mypy/dmypy_server.py", line 698, in fine_grained_increment_follow_imports
messages = fine_grained_manager.update([], to_delete)
File "/home/svalentin/src/mypy/mypy/server/update.py", line 267, in update
result = self.update_one(
File "/home/svalentin/src/mypy/mypy/server/update.py", line 369, in update_one
result = self.update_module(next_id, next_path, next_id in removed_set, followed)
File "/home/svalentin/src/mypy/mypy/server/update.py", line 452, in update_module
remaining += propagate_changes_using_dependencies(
File "/home/svalentin/src/mypy/mypy/server/update.py", line 881, in propagate_changes_using_dependencies
triggered |= reprocess_nodes(manager, graph, id, nodes, deps, processed_targets)
File "/home/svalentin/src/mypy/mypy/server/update.py", line 1025, in reprocess_nodes
more = checker.check_second_pass(nodes)
File "/home/svalentin/src/mypy/mypy/checker.py", line 547, in check_second_pass
self.check_partial(node)
File "/home/svalentin/src/mypy/mypy/checker.py", line 552, in check_partial
self.check_top_level(node)
File "/home/svalentin/src/mypy/mypy/checker.py", line 567, in check_top_level
d.accept(self)
File "/home/svalentin/src/mypy/mypy/nodes.py", line 1364, in accept
return visitor.visit_assignment_stmt(self)
File "/home/svalentin/src/mypy/mypy/checker.py", line 2978, in visit_assignment_stmt
self.check_type_alias_rvalue(s)
File "/home/svalentin/src/mypy/mypy/checker.py", line 3019, in check_type_alias_rvalue
alias_type = self.expr_checker.accept(s.rvalue)
File "/home/svalentin/src/mypy/mypy/checkexpr.py", line 5875, in accept
report_internal_error(
File "/home/svalentin/src/mypy/mypy/errors.py", line 1288, in report_internal_error
raise err
File "/home/svalentin/src/mypy/mypy/checkexpr.py", line 5873, in accept
typ = node.accept(self)
File "/home/svalentin/src/mypy/mypy/nodes.py", line 2127, in accept
return visitor.visit_op_expr(self)
File "/home/svalentin/src/mypy/mypy/checkexpr.py", line 3403, in visit_op_expr
return self.accept(e.analyzed)
File "/home/svalentin/src/mypy/mypy/checkexpr.py", line 5875, in accept
report_internal_error(
File "/home/svalentin/src/mypy/mypy/errors.py", line 1288, in report_internal_error
raise err
File "/home/svalentin/src/mypy/mypy/checkexpr.py", line 5873, in accept
typ = node.accept(self)
File "/home/svalentin/src/mypy/mypy/nodes.py", line 2729, in accept
return visitor.visit_type_alias_expr(self)
File "/home/svalentin/src/mypy/mypy/checkexpr.py", line 4769, in visit_type_alias_expr
return self.alias_type_in_runtime_context(alias.node, ctx=alias, alias_definition=True)
File "/home/svalentin/src/mypy/mypy/checkexpr.py", line 4833, in alias_type_in_runtime_context
return self.chk.named_generic_type("types.UnionType", item.items)
File "/home/svalentin/src/mypy/mypy/checker.py", line 7037, in named_generic_type
info = self.lookup_typeinfo(name)
File "/home/svalentin/src/mypy/mypy/checker.py", line 7044, in lookup_typeinfo
sym = self.lookup_qualified(fullname)
File "/home/svalentin/src/mypy/mypy/checker.py", line 7122, in lookup_qualified
n = self.modules[parts[0]]
KeyError: 'types'
Git bisected this error to https://github.com/python/mypy/commit/98a22c44c26ff436f1c343ad4727258ffd72e055 Before that commit, running dmypy on x.py, y.py and then x.py worked.
Though, it's most likely not that commit at fault by iteself, but an interraction with dmypy, or incremental checking. The second check for x.py takes noticeably longer even before that commit. So it's clearly doing something it shouldn't.
Crash Report
While trying to make a minimal repro of another bug, I noticed this reliable crasher
Traceback
To Reproduce
Your Environment
mypy.ini
(and other config files):