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

"AttributeError: 'AssignAttr' object has no attribute 'name'" with starred expression #2646

Open
correctmost opened this issue Dec 3, 2024 · 0 comments
Labels
Crash 💥 Needs PR This issue is accepted, sufficiently specified and now needs an implementation

Comments

@correctmost
Copy link
Contributor

Description

Astroid crashes on the following fuzzed code from pysource-codegen:

class c:
    a[t]

for *o.attr, (*t,) in ():
    pass

Backtrace

Exception on node <Subscript l.2 at 0x7bc5a43f8ad0> in file 'pylint/crash.py'
Traceback (most recent call last):
  File "pylint/pylint/checkers/utils.py", line 1365, in safe_infer
    value = next(infer_gen)
            ^^^^^^^^^^^^^^^
  File "astroid/astroid/nodes/node_ng.py", line 167, in infer
    for i, result in enumerate(self._infer(context=context, **kwargs)):
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "astroid/astroid/decorators.py", line 86, in inner
    yield next(generator)
          ^^^^^^^^^^^^^^^
  File "astroid/astroid/decorators.py", line 49, in wrapped
    for res in _func(node, context, **kwargs):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "astroid/astroid/bases.py", line 177, in _infer_stmts
    for inf in stmt.infer(context=context):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "astroid/astroid/nodes/node_ng.py", line 167, in infer
    for i, result in enumerate(self._infer(context=context, **kwargs)):
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "astroid/astroid/decorators.py", line 86, in inner
    yield next(generator)
          ^^^^^^^^^^^^^^^
  File "astroid/astroid/decorators.py", line 49, in wrapped
    for res in _func(node, context, **kwargs):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "astroid/astroid/nodes/node_classes.py", line 457, in _infer
    stmts = list(self.assigned_stmts(context=context))
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "astroid/astroid/decorators.py", line 69, in inner
    yield next(generator)
          ^^^^^^^^^^^^^^^
  File "astroid/astroid/protocols.py", line 817, in starred_assigned_stmts
    _determine_starred_iteration_lookups(self, target, lookups)
  File "astroid/astroid/protocols.py", line 707, in _determine_starred_iteration_lookups
    and element.value.name == starred.value.name
        ^^^^^^^^^^^^^^^^^^
AttributeError: 'AssignAttr' object has no attribute 'name'

Version

cae4388

@Pierre-Sassoulas Pierre-Sassoulas added Crash 💥 Needs PR This issue is accepted, sufficiently specified and now needs an implementation labels Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Crash 💥 Needs PR This issue is accepted, sufficiently specified and now needs an implementation
Projects
None yet
Development

No branches or pull requests

2 participants