λ cat test250.py
x = []
def f() -> None:
global x
x
λ mypy --no-incremental --show-traceback --allow-redefinition test250.py
test250.py:5: 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: 2.1.0+dev.16823a17c10ce5a00b0bbdee5fa9959dccea8ccc
Traceback (most recent call last):
File "/Users/shantanu/.virtualenvs/mypy-fexc/bin/mypy", line 10, in <module>
sys.exit(console_entry())
File "/Users/shantanu/dev/mypy/mypy/__main__.py", line 16, in console_entry
main()
File "/Users/shantanu/dev/mypy/mypy/main.py", line 154, in main
res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
File "/Users/shantanu/dev/mypy/mypy/main.py", line 244, in run_build
res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
File "/Users/shantanu/dev/mypy/mypy/build.py", line 422, in build
result = build_inner(
File "/Users/shantanu/dev/mypy/mypy/build.py", line 537, in build_inner
graph = dispatch(sources, manager, stdout, connect_threads)
File "/Users/shantanu/dev/mypy/mypy/build.py", line 4150, in dispatch
process_graph(graph, manager)
File "/Users/shantanu/dev/mypy/mypy/build.py", line 4618, in process_graph
done, still_working, results = manager.wait_for_done(graph)
File "/Users/shantanu/dev/mypy/mypy/build.py", line 1492, in wait_for_done
process_stale_scc(graph, next_scc, self)
File "/Users/shantanu/dev/mypy/mypy/build.py", line 4792, in process_stale_scc
graph[id].type_check_first_pass()
File "/Users/shantanu/dev/mypy/mypy/build.py", line 3414, in type_check_first_pass
self.type_checker().check_first_pass(recurse_into_functions=recurse_into_functions)
File "/Users/shantanu/dev/mypy/mypy/checker.py", line 618, in check_first_pass
self.accept(d)
File "/Users/shantanu/dev/mypy/mypy/checker.py", line 765, in accept
stmt.accept(self)
File "/Users/shantanu/dev/mypy/mypy/nodes.py", line 1159, in accept
return visitor.visit_func_def(self)
File "/Users/shantanu/dev/mypy/mypy/checker.py", line 1332, in visit_func_def
self.visit_func_def_impl(defn)
File "/Users/shantanu/dev/mypy/mypy/checker.py", line 1336, in visit_func_def_impl
self.check_func_item(defn, name=defn.name)
File "/Users/shantanu/dev/mypy/mypy/checker.py", line 1369, in check_func_item
self.check_func_def(defn, typ, name, allow_empty)
File "/Users/shantanu/dev/mypy/mypy/checker.py", line 1551, in check_func_def
self.accept(item.body)
File "/Users/shantanu/dev/mypy/mypy/checker.py", line 765, in accept
stmt.accept(self)
File "/Users/shantanu/dev/mypy/mypy/nodes.py", line 1816, in accept
return visitor.visit_block(self)
File "/Users/shantanu/dev/mypy/mypy/checker.py", line 3275, in visit_block
self.accept(s)
File "/Users/shantanu/dev/mypy/mypy/checker.py", line 765, in accept
stmt.accept(self)
File "/Users/shantanu/dev/mypy/mypy/nodes.py", line 1836, in accept
return visitor.visit_expression_stmt(self)
File "/Users/shantanu/dev/mypy/mypy/checker.py", line 5139, in visit_expression_stmt
expr_type = self.expr_checker.accept(s.expr, allow_none_return=True, always_allow_any=True)
File "/Users/shantanu/dev/mypy/mypy/checkexpr.py", line 6177, in accept
typ = node.accept(self) # r-value type, when interpreted as a value expression
File "/Users/shantanu/dev/mypy/mypy/nodes.py", line 2439, in accept
return visitor.visit_name_expr(self)
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "/Users/shantanu/dev/mypy/mypy/checkexpr.py", line 350, in visit_name_expr
narrowed = self.narrow_type_from_binder(e, result)
File "/Users/shantanu/dev/mypy/mypy/checkexpr.py", line 6486, in narrow_type_from_binder
narrowed = narrow_declared_type(known_type, restriction)
File "/Users/shantanu/dev/mypy/mypy/meet.py", line 185, in narrow_declared_type
elif not is_overlapping_types(declared, narrowed):
~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
File "/Users/shantanu/dev/mypy/mypy/meet.py", line 379, in is_overlapping_types
assert False, "Unexpectedly encountered partial type"
^^^^^
AssertionError: Unexpectedly encountered partial type