Skip to content

Crash on multiple assignment to tuple #1420

Closed

Description

@gvanrossum

Repro:

a, b = c, d = 0, 1

Traceback:

Traceback (most recent call last):
  File "/Users/guido/v3/bin/mypy", line 6, in <module>
    main(__file__)
  File "/Users/guido/v3/lib/python3.5/site-packages/mypy/main.py", line 52, in main
    res = type_check_only(sources, bin_dir, options)
  File "/Users/guido/v3/lib/python3.5/site-packages/mypy/main.py", line 100, in type_check_only
    python_path=options.python_path)
  File "/Users/guido/v3/lib/python3.5/site-packages/mypy/build.py", line 208, in build
    dispatch(sources, manager)
  File "/Users/guido/v3/lib/python3.5/site-packages/mypy/build.py", line 1251, in dispatch
    process_graph(graph, manager)
  File "/Users/guido/v3/lib/python3.5/site-packages/mypy/build.py", line 1382, in process_graph
    process_stale_scc(graph, scc)
  File "/Users/guido/v3/lib/python3.5/site-packages/mypy/build.py", line 1412, in process_stale_scc
    graph[id].type_check()
  File "/Users/guido/v3/lib/python3.5/site-packages/mypy/build.py", line 1231, in type_check
    manager.type_checker.visit_file(self.tree, self.xpath)
  File "/Users/guido/v3/lib/python3.5/site-packages/mypy/checker.py", line 419, in visit_file
    self.accept(d)
  File "/Users/guido/v3/lib/python3.5/site-packages/mypy/checker.py", line 460, in accept
    typ = node.accept(self)
  File "/Users/guido/v3/lib/python3.5/site-packages/mypy/nodes.py", line 753, in accept
    return visitor.visit_assignment_stmt(self)
  File "/Users/guido/v3/lib/python3.5/site-packages/mypy/checker.py", line 1147, in visit_assignment_stmt
    rvalue = self.temp_node(self.type_map[s.rvalue], s)
KeyError: <mypy.nodes.TupleExpr object at 0x105d158d0>

Activity

  1. alon commented on Apr 25, 2016

    @alon

    oops, thanks for finding the duplicate. Just a note, it also fails on the slightly simpler:

    a = b, c = 0, 1

  2. added this to the milestone on Apr 28, 2016
  3. self-assigned this
    on Apr 28, 2016
  4. gvanrossum commented on Apr 28, 2016

    @gvanrossum
    MemberAuthor

    Dupe of #974

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

Metadata

Metadata

Assignees

Labels

bugmypy got something wrong

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions