Skip to content

multiple assignments with tuple lvalue raise KeyError - type not stored yet #1438

Closed

Description

@alon

Minimal example to reproduce:
a = b, c = 1, 2
Checkout from right now
(btw - no annotated tags, git describe complains, would be nice to fix):

8bd292c

Complete stack trace:

$ echo "a = b, c = 1, 2" | (PYTHONPATH=. ./scripts/mypy /dev/stdin)
Traceback (most recent call last):
  File "./scripts/mypy", line 6, in <module>
    main(__file__)
  File "/home/alon/mypy/mypy/main.py", line 52, in main
    res = type_check_only(sources, bin_dir, options)
  File "/home/alon/mypy/mypy/main.py", line 100, in type_check_only
    python_path=options.python_path)
  File "/home/alon/mypy/mypy/build.py", line 208, in build
    dispatch(sources, manager)
  File "/home/alon/mypy/mypy/build.py", line 1253, in dispatch
    process_graph(graph, manager)
  File "/home/alon/mypy/mypy/build.py", line 1384, in process_graph
    process_stale_scc(graph, scc)
  File "/home/alon/mypy/mypy/build.py", line 1414, in process_stale_scc
    graph[id].type_check()
  File "/home/alon/mypy/mypy/build.py", line 1233, in type_check
    manager.type_checker.visit_file(self.tree, self.xpath)
  File "/home/alon/mypy/mypy/checker.py", line 419, in visit_file
    self.accept(d)
  File "/home/alon/mypy/mypy/checker.py", line 460, in accept
    typ = node.accept(self)
  File "/home/alon/mypy/mypy/nodes.py", line 753, in accept
    return visitor.visit_assignment_stmt(self)
  File "/home/alon/mypy/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 0x7f32a220b240>

Activity

  1. alon commented on Apr 25, 2016

    @alon
    Author

    (updated the example to an even simpler one - previously had a,b=c,d=1,2 ; but a simpler one is a=b,c=1,2)

  2. gvanrossum commented on Apr 25, 2016

    @gvanrossum
    Member

    Duplicate of #1420.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions