Skip to content

Uncaught InferenceError: Inference failed for all members of AssignAttr in types checker #11356

Description

@correctmost

Bug description

# Code from a local fuzzing run

from collections.abc import GenericAlias

class C:
    pass

x = C.a

for GenericAlias.a in _:
    pass

Configuration

Command used

pylint crash.py

Pylint output

Exception on node <Attribute.a l.6 at 0x7f316c6967b0> in file '/home/user/crash.py'
Traceback (most recent call last):
  File "pylint/pylint/utils/ast_walker.py", line 87, in walk
    callback(astroid)
    ~~~~~~~~^^^^^^^^^
  File "pylint/pylint/checkers/typecheck.py", line 1208, in visit_attribute
    attr_nodes = owner.getattr(node.attrname)
  File "astroid/astroid/nodes/scoped_nodes/scoped_nodes.py", line 2373, in getattr
    values += self._metaclass_lookup_attribute(name, context)
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
  File "astroid/astroid/nodes/scoped_nodes/scoped_nodes.py", line 2399, in _metaclass_lookup_attribute
    attrs.update(cls_attributes)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^
  File "astroid/astroid/nodes/scoped_nodes/scoped_nodes.py", line 2410, in _get_attribute_from_metaclass
    for attr in bases._infer_stmts(attrs, context, frame=cls):
                ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "astroid/astroid/bases.py", line 203, in _infer_stmts
    raise InferenceError(
    ...<4 lines>...
    )
astroid.exceptions.InferenceError: Inference failed for all members of [<AssignAttr.a l.8 at 0x7f316c696a50>].

Expected behavior

No crash

Pylint version

pylint-dev/astroid@cec5b897
pylint-dev/pylint@5ba4f69e7
Python 3.14.7

The crash also affects Pylint 4.0.7

OS / Environment

Arch Linux

Additional dependencies

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions