Skip to content
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

Crash in IterableChecker with starred expression #6372

Closed
jacobtylerwalls opened this issue Apr 17, 2022 · 0 comments · Fixed by #6477
Closed

Crash in IterableChecker with starred expression #6372

jacobtylerwalls opened this issue Apr 17, 2022 · 0 comments · Fixed by #6477
Labels
Astroid Related to astroid Crash 💥 A bug that makes pylint crash
Milestone

Comments

@jacobtylerwalls
Copy link
Member

jacobtylerwalls commented Apr 17, 2022

Bug description

Simplified from an example in pip (their vendored copy of rich)

string_ones = "".join(str(*y) for _, *y in [[1, 1], [1, 1]])

Configuration

n/a

Command used

pylint a.py

Pylint output

Exception on node <Call l.1 at 0x1076704c0> in file '/Users/.../pylint/a.py'
Traceback (most recent call last):
  File "/Users/.../pylint/pylint/utils/ast_walker.py", line 73, in walk
    callback(astroid)
  File "/Users/.../pylint/pylint/checkers/typecheck.py", line 2076, in visit_call
    self._check_iterable(stararg.value)
  File "/Users/.../pylint/pylint/checkers/typecheck.py", line 2041, in _check_iterable
    inferred = safe_infer(node)
  File "/Users/.../pylint/pylint/checkers/utils.py", line 1225, in safe_infer
    value = next(infer_gen)
  File "/Users/.../astroid/astroid/nodes/node_ng.py", line 166, in infer
    yield from self._infer(context=context, **kwargs)
  File "/Users/.../astroid/astroid/decorators.py", line 136, in raise_if_nothing_inferred
    yield next(generator)
  File "/Users/.../astroid/astroid/decorators.py", line 105, in wrapped
    for res in _func(node, context, **kwargs):
  File "/Users/.../astroid/astroid/bases.py", line 134, in _infer_stmts
    for inf in stmt.infer(context=context):
  File "/Users/.../astroid/astroid/nodes/node_ng.py", line 180, in infer
    for i, result in enumerate(generator):
  File "/Users/.../astroid/astroid/decorators.py", line 136, in raise_if_nothing_inferred
    yield next(generator)
  File "/Users/.../astroid/astroid/decorators.py", line 105, in wrapped
    for res in _func(node, context, **kwargs):
  File "/Users/.../astroid/astroid/inference.py", line 954, in infer_assign
    stmts = list(self.assigned_stmts(context=context))
  File "/Users/.../astroid/astroid/decorators.py", line 123, in yes_if_nothing_inferred
    yield next(generator)
  File "/Users/.../astroid/astroid/protocols.py", line 725, in starred_assigned_stmts
    for index, left_node in enumerate(lhs.elts):
AttributeError: 'AssignName' object has no attribute 'elts'

Expected behavior

no msg

Pylint version

pylint 2.14.0-dev0
astroid 2.12.0-dev0
Python 3.10.1 (v3.10.1:2cd268a3a9, Dec  6 2021, 14:28:59) [Clang 13.0.0 (clang-1300.0.29.3)]

Reproduced on pylint 2.0.0 also!

OS / Environment

No response

Additional dependencies

No response

@jacobtylerwalls jacobtylerwalls added Astroid Related to astroid Crash 💥 A bug that makes pylint crash labels Apr 17, 2022
@jacobtylerwalls jacobtylerwalls added this to the 2.14.0 milestone Apr 17, 2022
@jacobtylerwalls jacobtylerwalls added Needs astroid update Needs an astroid update (probably a release too) before being mergable and removed Needs astroid update Needs an astroid update (probably a release too) before being mergable labels Apr 30, 2022
jacobtylerwalls added a commit to jacobtylerwalls/pylint that referenced this issue Apr 30, 2022
Pierre-Sassoulas pushed a commit that referenced this issue May 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Astroid Related to astroid Crash 💥 A bug that makes pylint crash
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant