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
@sobolevn I will try. Sadly, could only reproduce it on a fresh repo ones, and then it went away. For our project tho, it never goes away, does not matter which version combination i would take with stubs and mypy :( Ima try to pick it out of our giant repo.
aiohttp/http_parser.py: 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: 0.920+dev.43eecdb0969c8cb8777fa802ba53e11075b4c802
Traceback (most recent call last):
File "/usr/local/bin/mypy", line 8, in <module>
sys.exit(console_entry())
File "/usr/local/lib/python3.9/site-packages/mypy/__main__.py", line 11, in console_entry
main(None, sys.stdout, sys.stderr)
File "/usr/local/lib/python3.9/site-packages/mypy/main.py", line 92, in main
res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
File "/usr/local/lib/python3.9/site-packages/mypy/main.py", line 170, in run_build
res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
File "/usr/local/lib/python3.9/site-packages/mypy/build.py", line 180, in build
result = _build(
File "/usr/local/lib/python3.9/site-packages/mypy/build.py", line 256, in _build
graph = dispatch(sources, manager, stdout)
File "/usr/local/lib/python3.9/site-packages/mypy/build.py", line 2712, in dispatch
process_graph(graph, manager)
File "/usr/local/lib/python3.9/site-packages/mypy/build.py", line 3043, in process_graph
process_stale_scc(graph, scc, manager)
File "/usr/local/lib/python3.9/site-packages/mypy/build.py", line 3152, in process_stale_scc
graph[id].finish_passes()
File "/usr/local/lib/python3.9/site-packages/mypy/build.py", line 2225, in finish_passes
free_tree(self.tree)
File "/usr/local/Cellar/python@3.9/3.9.8/Frameworks/Python.framework/Versions/3.9/lib/python3.9/contextlib.py", line 137, in __exit__
self.gen.throw(typ, value, traceback)
File "/usr/local/lib/python3.9/site-packages/mypy/build.py", line 1964, in wrap_context
yield
File "/usr/local/lib/python3.9/site-packages/mypy/build.py", line 2222, in finish_passes
self.update_fine_grained_deps(self.manager.fg_deps)
File "/usr/local/lib/python3.9/site-packages/mypy/build.py", line 2272, in update_fine_grained_deps
merge_dependencies(self.compute_fine_grained_deps(), deps)
File "/usr/local/lib/python3.9/site-packages/mypy/build.py", line 2263, in compute_fine_grained_deps
return get_dependencies(target=self.tree,
File "/usr/local/lib/python3.9/site-packages/mypy/server/deps.py", line 117, in get_dependencies
target.accept(visitor)
File "/usr/local/lib/python3.9/site-packages/mypy/nodes.py", line 326, in accept
return visitor.visit_mypy_file(self)
File "/usr/local/lib/python3.9/site-packages/mypy/server/deps.py", line 177, in visit_mypy_file
super().visit_mypy_file(o)
File "/usr/local/lib/python3.9/site-packages/mypy/traverser.py", line 37, in visit_mypy_file
d.accept(self)
File "/usr/local/lib/python3.9/site-packages/mypy/nodes.py", line 1000, in accept
return visitor.visit_class_def(self)
File "/usr/local/lib/python3.9/site-packages/mypy/server/deps.py", line 238, in visit_class_def
super().visit_class_def(o)
File "/usr/local/lib/python3.9/site-packages/mypy/traverser.py", line 73, in visit_class_def
o.defs.accept(self)
File "/usr/local/lib/python3.9/site-packages/mypy/nodes.py", line 1069, in accept
return visitor.visit_block(self)
File "/usr/local/lib/python3.9/site-packages/mypy/server/deps.py", line 348, in visit_block
super().visit_block(o)
File "/usr/local/lib/python3.9/site-packages/mypy/traverser.py", line 41, in visit_block
s.accept(self)
File "/usr/local/lib/python3.9/site-packages/mypy/nodes.py", line 727, in accept
return visitor.visit_func_def(self)
File "/usr/local/lib/python3.9/site-packages/mypy/server/deps.py", line 201, in visit_func_def
super().visit_func_def(ex)
File "/usr/local/lib/python3.9/site-packages/mypy/traverser.py", line 56, in visit_func_def
self.visit_func(o)
File "/usr/local/lib/python3.9/site-packages/mypy/traverser.py", line 53, in visit_func
o.body.accept(self)
File "/usr/local/lib/python3.9/site-packages/mypy/nodes.py", line 1069, in accept
return visitor.visit_block(self)
File "/usr/local/lib/python3.9/site-packages/mypy/server/deps.py", line 348, in visit_block
super().visit_block(o)
File "/usr/local/lib/python3.9/site-packages/mypy/traverser.py", line 41, in visit_block
s.accept(self)
File "/usr/local/lib/python3.9/site-packages/mypy/nodes.py", line 1135, in accept
return visitor.visit_assignment_stmt(self)
File "/usr/local/lib/python3.9/site-packages/mypy/server/deps.py", line 400, in visit_assignment_stmt
self.process_lvalue(lvalue)
File "/usr/local/lib/python3.9/site-packages/mypy/server/deps.py", line 460, in process_lvalue
lvalue_type = self.get_non_partial_lvalue_type(lvalue)
File "/usr/local/lib/python3.9/site-packages/mypy/server/deps.py", line 492, in get_non_partial_lvalue_type
assert not lvalue.is_new_def
AssertionError:
Any ideas on how we might solve it? I haven't contributed to mypy, and honestly I'm not completely sure what purpose this assert has in the first place.
File "/usr/local/lib/python3.9/site-packages/mypy/server/deps.py", line 400, in visit_assignment_stmt
self.process_lvalue(lvalue)
File "/usr/local/lib/python3.9/site-packages/mypy/server/deps.py", line 460, in process_lvalue
lvalue_type = self.get_non_partial_lvalue_type(lvalue)
File "/usr/local/lib/python3.9/site-packages/mypy/server/deps.py", line 492, in get_non_partial_lvalue_type
assert not lvalue.is_new_def
I've never touched this part of mypy before. And these lines of code are quite old (4 years):
Activity
sobolevn commentedon Nov 4, 2021
Please, report it in our repo: https://github.com/typeddjango/django-stubs/
Also:
1.9.0, it might help!Thanks!
Thorbenl commentedon Nov 8, 2021
@sobolevn I will try. Sadly, could only reproduce it on a fresh repo ones, and then it went away. For our project tho, it never goes away, does not matter which version combination i would take with stubs and mypy :( Ima try to pick it out of our giant repo.
christianbundy commentedon Nov 16, 2021
Having the same problem here, it started with a
Pipfile.lockupdate recently and only affects dmypy. We're running django-stubs@1.9.0.christianbundy commentedon Nov 17, 2021
@Thorbenl Any chance you have aiohttp as a dependency? I dropped into pdb and here's what I saw:
After bisecting the project history, it looks like aio-libs/aiohttp@a6c7f15 as the problematic commit.
You can repro by creating
mypy.iniin aiohttp with the contents:And running
mypy ..(Technically you don't have to run errors, but this lets you bisect automatically.)
cc: @asvetlov
christianbundy commentedon Nov 17, 2021
Found the problem, although I'm not completely sure why it's a problem:
christianbundy commentedon Nov 17, 2021
Full traceback:
christianbundy commentedon Nov 17, 2021
Minimal repro!
This seems to happen when:
TypeVar(T) has 2+ types.Generic[T]None.🤯
sobolevn commentedon Nov 17, 2021
Btw, this works fine:
The problem reveals itself only if
self.example_attribute = Noneis in place.Great insight, thanks!
christianbundy commentedon Nov 17, 2021
Any ideas on how we might solve it? I haven't contributed to mypy, and honestly I'm not completely sure what purpose this
asserthas in the first place.sobolevn commentedon Nov 17, 2021
It happens here:
I've never touched this part of mypy before. And these lines of code are quite old (4 years):
mypy/mypy/server/deps.py
Lines 487 to 493 in 43eecdb
Git Blame Link
This can either be:
ifbug, where we just forgot to add some conditionsobolevn commentedon Nov 17, 2021
@christianbundy this seems to remove the crash:
But, I am not sure it is correct though. Do you want to send a PR? We can work from there!
Fix `None` assignments with fine-grained cache
christianbundy commentedon Nov 17, 2021
Good idea, thank you!
Fix `None` assignments with fine-grained cache (#11574)
chore: 🤖 avoid an error in vsscode with mypy daemon
Fix `None` assignments with fine-grained cache (python#11574)
chore: 🤖 avoid an error in vsscode with mypy daemon