Skip to content

mypy crashes with arguments --ignore-missing-imports --follow-imports skip #2778

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

Closed
marcharper opened this issue Jan 31, 2017 · 4 comments
Closed

Comments

@marcharper
Copy link

marcharper commented Jan 31, 2017

mypy --ignore-missing-imports --follow-imports skip -m my_module

(py3) user@...$ mypy --ignore-missing-imports --follow-imports skip -m axelrod
Traceback (most recent call last):
  File "/home/user/anaconda2/envs/py3/bin/mypy", line 6, in <module>
    main(__file__)
  File "/home/user/anaconda2/envs/py3/lib/python3.5/site-packages/mypy/main.py", line 42, in main
    res = type_check_only(sources, bin_dir, options)
  File "/home/user/anaconda2/envs/py3/lib/python3.5/site-packages/mypy/main.py", line 87, in type_check_only
    options=options)
  File "/home/user/anaconda2/envs/py3/lib/python3.5/site-packages/mypy/build.py", line 183, in build
    dispatch(sources, manager)
  File "/home/user/anaconda2/envs/py3/lib/python3.5/site-packages/mypy/build.py", line 1526, in dispatch
    process_graph(graph, manager)
  File "/home/user/anaconda2/envs/py3/lib/python3.5/site-packages/mypy/build.py", line 1652, in process_graph
    sccs = sorted_components(graph)
  File "/home/user/anaconda2/envs/py3/lib/python3.5/site-packages/mypy/build.py", line 1879, in sorted_components
    for ready in topsort(data):
  File "/home/user/anaconda2/envs/py3/lib/python3.5/site-packages/mypy/build.py", line 1988, in topsort
    for item in set.union(*data.values()) - set(data.keys()):
TypeError: descriptor 'union' of 'set' object needs an argument

Running the same command with individual files in the module works fine (no crash, type errors caught and reported as expected).

@JukkaL
Copy link
Collaborator

JukkaL commented Jan 31, 2017

I can reproduce this:

$ touch b.py
$ mypy --ignore-missing-imports --follow-imports skip -m b

@gvanrossum gvanrossum self-assigned this Jan 31, 2017
@gvanrossum
Copy link
Member

Aha, the problem is that because of the --follow-imports=skip it doesn't want to load b so it ends with an entirely empty graph. The fix will have to involve ensuring that it does follow these kinds of "imports". Stay tuned.

@gvanrossum
Copy link
Member

I think I've got a fix, but I need to devise a test.

@gvanrossum
Copy link
Member

Closed by #2786.

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

No branches or pull requests

3 participants