Skip to content
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

Incremental type check broken #3202

Closed
pkch opened this issue Apr 20, 2017 · 2 comments · Fixed by #3203
Closed

Incremental type check broken #3202

pkch opened this issue Apr 20, 2017 · 2 comments · Fixed by #3203

Comments

@pkch
Copy link
Contributor

pkch commented Apr 20, 2017

This is based on my analysis of the differences of the test results with and without builtins fixtures (#3111).

It seems that incremental type check is broken on master, unless there's something really weird with my platform.

To replicate create two files:

# b.py
from a import A

def f(x: A) -> None:
    x.g()

and

# a.py
class A:
    def g(self) -> None: pass

Then run

rm -rf .mypy_cache
mypy -i b.py
touch a.py
mypy -i b.py

This results in the following (both on Win64 and Linux):

$ mypy b.py
(mypy) [pkch@kanto mypy] 2017-04-19 22:15:03 (master)
$ mypy -i b.py
(mypy) [pkch@kanto mypy] 2017-04-19 22:15:19 (master)
$ touch a.py
(mypy) [pkch@kanto mypy] 2017-04-19 22:15:23 (master)
$ mypy -i b.py
Traceback (most recent call last):
  File "/home/pkch/.virtualenvs/mypy/bin/mypy", line 6, in <module>
    exec(compile(open(__file__).read(), __file__, 'exec'))
  File "/mnt/c/Users/pkch/Downloads/mypy/scripts/mypy", line 6, in <module>
    main(__file__)
  File "/mnt/c/Users/pkch/Downloads/mypy/mypy/main.py", line 46, in main
    res = type_check_only(sources, bin_dir, options)
  File "/mnt/c/Users/pkch/Downloads/mypy/mypy/main.py", line 93, in type_check_only
    options=options)
  File "/mnt/c/Users/pkch/Downloads/mypy/mypy/build.py", line 188, in build
    graph = dispatch(sources, manager)
  File "/mnt/c/Users/pkch/Downloads/mypy/mypy/build.py", line 1570, in dispatch
    process_graph(graph, manager)
  File "/mnt/c/Users/pkch/Downloads/mypy/mypy/build.py", line 1806, in process_graph
    process_fresh_scc(graph, prev_scc)
  File "/mnt/c/Users/pkch/Downloads/mypy/mypy/build.py", line 1875, in process_fresh_scc
    graph[id].fix_cross_refs()
  File "/mnt/c/Users/pkch/Downloads/mypy/mypy/build.py", line 1341, in fix_cross_refs
    self.manager.options.quick_and_dirty)
  File "/mnt/c/Users/pkch/Downloads/mypy/mypy/fixup.py", line 22, in fixup_module_pass_one
    node_fixer.visit_symbol_table(tree.names)
  File "/mnt/c/Users/pkch/Downloads/mypy/mypy/fixup.py", line 81, in visit_symbol_table
    self.quick_and_dirty)
  File "/mnt/c/Users/pkch/Downloads/mypy/mypy/fixup.py", line 256, in lookup_qualified_stnode
    assert '.' in head, "Cannot find %s" % (name,)
AssertionError: Cannot find importlib.abc.Loader
(mypy) [pkch@kanto mypy] 2017-04-19 22:15:26 (master)
$
@pkch
Copy link
Contributor Author

pkch commented Apr 20, 2017

And bisect suggests it was introduced in my own PR #3107 . I'm looking into that.

@ilevkivskyi
Copy link
Member

Confirmed. I see the same crash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants