-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
Crash 💥A bug that makes pylint crashA bug that makes pylint crashNeeds PRThis issue is accepted, sufficiently specified and now needs an implementationThis issue is accepted, sufficiently specified and now needs an implementation
Milestone
Description
Bug description
When parsing the following a.py:
class Test:
__slots__ = ["a", "b", "c"]
class TestChild(Test):
__slots__ += ["d", "e", "f"]
t = TestChild()
print(t.__slots__)Command used
pylint a.pyPylint output
pylint crashed with a ``AstroidError`` and with the following stacktrace:
Traceback (most recent call last):
File "c:\Users\Matth\.vscode\extensions\ms-python.pylint-2023.10.1\bundled\libs\pylint\lint\pylinter.py", line 788, in _lint_file
check_astroid_module(module)
File "c:\Users\Matth\.vscode\extensions\ms-python.pylint-2023.10.1\bundled\libs\pylint\lint\pylinter.py", line 1017, in check_astroid_module
retval = self._check_astroid_module(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\Matth\.vscode\extensions\ms-python.pylint-2023.10.1\bundled\libs\pylint\lint\pylinter.py", line 1069, in _check_astroid_module
walker.walk(node)
File "c:\Users\Matth\.vscode\extensions\ms-python.pylint-2023.10.1\bundled\libs\pylint\utils\ast_walker.py", line 94, in walk
self.walk(child)
File "c:\Users\Matth\.vscode\extensions\ms-python.pylint-2023.10.1\bundled\libs\pylint\utils\ast_walker.py", line 91, in walk
callback(astroid)
File "c:\Users\Matth\.vscode\extensions\ms-python.pylint-2023.10.1\bundled\libs\pylint\checkers\classes\class_checker.py", line 879, in visit_classdef
self._check_slots(node)
File "c:\Users\Matth\.vscode\extensions\ms-python.pylint-2023.10.1\bundled\libs\pylint\checkers\classes\class_checker.py", line 1492, in _check_slots
for slots in node.ilookup("__slots__"):
File "c:\Users\Matth\.vscode\extensions\ms-python.pylint-2023.10.1\bundled\libs\astroid\bases.py", line 194, in _infer_stmts
raise InferenceError(
astroid.exceptions.InferenceError: Inference failed for all members of [<AssignName.__slots__ l.5 at 0x14ef5196a20>].
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "c:\Users\Matth\.vscode\extensions\ms-python.pylint-2023.10.1\bundled\libs\pylint\lint\pylinter.py", line 752, in _lint_files
self._lint_file(fileitem, module, check_astroid_module)
File "c:\Users\Matth\.vscode\extensions\ms-python.pylint-2023.10.1\bundled\libs\pylint\lint\pylinter.py", line 790, in _lint_file
raise astroid.AstroidError from e
astroid.exceptions.AstroidErrorExpected behavior
No crash.
Pylint version
pylint 3.0.2
astroid 3.0.1
Python 3.12.1 (tags/v3.12.1:2305ca5, Dec 7 2023, 22:03:25) [MSC v.1937 64 bit (AMD64)]OS / Environment
win32 (Windows)
Metadata
Metadata
Assignees
Labels
Crash 💥A bug that makes pylint crashA bug that makes pylint crashNeeds PRThis issue is accepted, sufficiently specified and now needs an implementationThis issue is accepted, sufficiently specified and now needs an implementation