Skip to content

isinstance with single argument causes crash #3650

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
JukkaL opened this issue Jul 4, 2017 · 2 comments
Closed

isinstance with single argument causes crash #3650

JukkaL opened this issue Jul 4, 2017 · 2 comments

Comments

@JukkaL
Copy link
Collaborator

JukkaL commented Jul 4, 2017

This crashes mypy:

isinstance(1)

Traceback:

Traceback (most recent call last):
  File "/Users/jukka/src/mypy/scripts/mypy", line 6, in <module>
    main(__file__)
  File "/Users/jukka/src/mypy/mypy/main.py", line 50, in main
    res = type_check_only(sources, bin_dir, options)
  File "/Users/jukka/src/mypy/mypy/main.py", line 97, in type_check_only
    options=options)
  File "/Users/jukka/src/mypy/mypy/build.py", line 192, in build
    graph = dispatch(sources, manager)
  File "/Users/jukka/src/mypy/mypy/build.py", line 1761, in dispatch
    process_graph(graph, manager)
  File "/Users/jukka/src/mypy/mypy/build.py", line 2004, in process_graph
    process_stale_scc(graph, scc, manager)
  File "/Users/jukka/src/mypy/mypy/build.py", line 2107, in process_stale_scc
    graph[id].type_check_first_pass()
  File "/Users/jukka/src/mypy/mypy/build.py", line 1676, in type_check_first_pass
    self.type_checker.check_first_pass()
  File "/Users/jukka/src/mypy/mypy/checker.py", line 185, in check_first_pass
    self.accept(d)
  File "/Users/jukka/src/mypy/mypy/checker.py", line 273, in accept
    stmt.accept(self)
  File "/Users/jukka/src/mypy/mypy/nodes.py", line 829, in accept
    return visitor.visit_expression_stmt(self)
  File "/Users/jukka/src/mypy/mypy/checker.py", line 1880, in visit_expression_stmt
    self.expr_checker.accept(s.expr, allow_none_return=True, always_allow_any=True)
  File "/Users/jukka/src/mypy/mypy/checkexpr.py", line 2223, in accept
    typ = self.visit_call_expr(node, allow_none_return=True)
  File "/Users/jukka/src/mypy/mypy/checkexpr.py", line 196, in visit_call_expr
    for typ in mypy.checker.flatten(e.args[1]):
IndexError: list index out of range
@ilevkivskyi
Copy link
Member

My fault, missed this when reviewing PR #3040 (fortunately this is easy to fix).

@JukkaL
Copy link
Collaborator Author

JukkaL commented Jul 4, 2017

No problem, this clearly highlights that we had some missing test cases. I can come up with a fix.

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

2 participants