Skip to content

Crash for tuple unpacking in assignment rhs #8635

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
opk12 opened this issue Apr 5, 2020 · 1 comment
Closed

Crash for tuple unpacking in assignment rhs #8635

opk12 opened this issue Apr 5, 2020 · 1 comment

Comments

@opk12
Copy link

opk12 commented Apr 5, 2020

$  cat test.py 
a, b = *(1, 2)

$  mypy test.py --show-traceback
test.py:1: error: Can use starred expression only as assignment target
test.py:1: error: INTERNAL ERROR -- Please try using mypy master on Github:
https://mypy.rtfd.io/en/latest/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 0.770+dev.d54fc8e78a8dd5be3c97c1aa0da357e313113dec
Traceback (most recent call last):
  File "/venv_/bin/mypy", line 8, in <module>
    sys.exit(console_entry())
  File "/venv_/lib64/python3.8/site-packages/mypy/__main__.py", line 8, in console_entry
    main(None, sys.stdout, sys.stderr)
  File "/venv_/lib64/python3.8/site-packages/mypy/main.py", line 89, in main
    res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
  File "/venv_/lib64/python3.8/site-packages/mypy/build.py", line 180, in build
    result = _build(
  File "/venv_/lib64/python3.8/site-packages/mypy/build.py", line 252, in _build
    graph = dispatch(sources, manager, stdout)
  File "/venv_/lib64/python3.8/site-packages/mypy/build.py", line 2611, in dispatch
    process_graph(graph, manager)
  File "/venv_/lib64/python3.8/site-packages/mypy/build.py", line 2918, in process_graph
    process_stale_scc(graph, scc, manager)
  File "/venv_/lib64/python3.8/site-packages/mypy/build.py", line 3016, in process_stale_scc
    graph[id].type_check_first_pass()
  File "/venv_/lib64/python3.8/site-packages/mypy/build.py", line 2107, in type_check_first_pass
    self.type_checker().check_first_pass()
  File "/venv_/lib64/python3.8/site-packages/mypy/checker.py", line 294, in check_first_pass
    self.accept(d)
  File "/venv_/lib64/python3.8/site-packages/mypy/checker.py", line 401, in accept
    stmt.accept(self)
  File "/venv_/lib64/python3.8/site-packages/mypy/nodes.py", line 1062, in accept
    return visitor.visit_assignment_stmt(self)
  File "/venv_/lib64/python3.8/site-packages/mypy/checker.py", line 2011, in visit_assignment_stmt
    self.check_assignment(s.lvalues[-1], s.rvalue, s.type is None, s.new_syntax)
  File "/venv_/lib64/python3.8/site-packages/mypy/checker.py", line 2049, in check_assignment
    self.check_assignment_to_multiple_lvalues(lvalue.items, rvalue, rvalue,
  File "/venv_/lib64/python3.8/site-packages/mypy/checker.py", line 2510, in check_assignment_to_multiple_lvalues
    self.check_multi_assignment(lvalues, rvalue, context, infer_lvalue_type)
  File "/venv_/lib64/python3.8/site-packages/mypy/checker.py", line 2557, in check_multi_assignment
    self.check_multi_assignment_from_iterable(lvalues, rvalue_type,
  File "/venv_/lib64/python3.8/site-packages/mypy/checker.py", line 2735, in check_multi_assignment_from_iterable
    if self.type_is_iterable(rvalue_type) and isinstance(rvalue_type, Instance):
  File "/venv_/lib64/python3.8/site-packages/mypy/checker.py", line 2728, in type_is_iterable
    return is_subtype(type, self.named_generic_type('typing.Iterable',
  File "/venv_/lib64/python3.8/site-packages/mypy/subtypes.py", line 93, in is_subtype
    return _is_subtype(left, right,
  File "/venv_/lib64/python3.8/site-packages/mypy/subtypes.py", line 135, in _is_subtype
    return left.accept(SubtypeVisitor(orig_right,
  File "/venv_/lib64/python3.8/site-packages/mypy/types.py", line 1676, in accept
    assert isinstance(visitor, SyntheticTypeVisitor)
AssertionError: 
test.py:1: : note: use --pdb to drop into pdb

Version: Python 3.8.2, mypy master, Fedora 32

@JukkaL
Copy link
Collaborator

JukkaL commented Apr 9, 2020

This seems to be essentially a duplicate of #3825 (or another related case).

@JukkaL JukkaL closed this as completed Apr 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants