Skip to content

AttributeError: 'Slice' object has no attribute 'qname' in code_style checker #10708

@correctmost

Description

@correctmost

Bug description

The code_style checker crashes on this code from #8067:

x = slice(42)
x()

Configuration

Command used

pylint --enable-all-extensions crash.py

Pylint output

Traceback (most recent call last):
  File "pylint/pylint/utils/ast_walker.py", line 87, in walk
    callback(astroid)
    ~~~~~~~~^^^^^^^^^
  File "pylint/pylint/extensions/code_style.py", line 118, in visit_call
    if called.qname() == "collections.namedtuple":
       ^^^^^^^^^^^^
AttributeError: 'Slice' object has no attribute 'qname'. Did you mean: 'frame'?

Expected behavior

No crash

Pylint version

pylint: bb9df16
astroid: pylint-dev/astroid@bd6e3049db110
Python 3.13.7

OS / Environment

Arch Linux

Additional dependencies

Metadata

Metadata

Assignees

No one assigned

    Labels

    Crash 💥A bug that makes pylint crashNeeds PRThis issue is accepted, sufficiently specified and now needs an implementation

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions