You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pylint crashed with a AstroidError and with the following stacktrace:
Traceback (most recent call last):
File "c:\Users\User\example\venv\lib\site-packages\astroid\nodes\scoped_nodes\scoped_nodes.py", line 2663, in igetattr
attributes = self.getattr(name, context, class_context=class_context)
File "c:\Users\User\example\venv\lib\site-packages\astroid\nodes\scoped_nodes\scoped_nodes.py", line 2603, in getattr
raise AttributeInferenceError(
astroid.exceptions.AttributeInferenceError: '__slots__' not found on <ClassDef.Foo l.2 at 0x13232ba3220>.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "c:\Users\User\example\venv\lib\site-packages\pylint\lint\pylinter.py", line 727, in _check_file
check_astroid_module(ast_node)
File "c:\Users\User\example\venv\lib\site-packages\pylint\lint\pylinter.py", line 926, in check_astroid_module
retval = self._check_astroid_module(
File "c:\Users\User\example\venv\lib\site-packages\pylint\lint\pylinter.py", line 976, in _check_astroid_module
walker.walk(node)
File "c:\Users\User\example\venv\lib\site-packages\pylint\utils\ast_walker.py", line 93, in walk
self.walk(child)
File "c:\Users\User\example\venv\lib\site-packages\pylint\utils\ast_walker.py", line 90, in walk
callback(astroid)
File "c:\Users\User\example\venv\lib\site-packages\pylint\checkers\classes\class_checker.py", line 838, in visit_classdef
self._check_slots(node)
File "c:\Users\User\example\venv\lib\site-packages\pylint\checkers\classes\class_checker.py", line 1369, in _check_slots
for slots in node.igetattr("__slots__"):
File "c:\Users\User\example\venv\lib\site-packages\astroid\nodes\scoped_nodes\scoped_nodes.py", line 2714, in igetattr
raise InferenceError(
astroid.exceptions.InferenceError: '__slots__' not found on <ClassDef.Foo l.2 at 0x13232ba3220>.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "c:\Users\User\example\venv\lib\site-packages\pylint\lint\pylinter.py", line 684, in _check_files
self._check_file(get_ast, check_astroid_module, file)
File "c:\Users\User\example\venv\lib\site-packages\pylint\lint\pylinter.py", line 729, in _check_file
raise astroid.AstroidError from e
astroid.exceptions.AstroidError
A hotfix to my code is simply to assign a value to __slots__ in the class definition.
Expecting pylint not to crash and an empty output or warning/error telling that I am using a defined but unassigned __slots__.
Configuration
No response
Command used
pylint example.py
Pylint output
In the editor:
c:\Users\User\example\example.py: Fatal error while checking 'c:\Users\User\example\example.py'. Please open an issue in our bug tracker so we address this. There is a pre-filled template that you can use in'C:\Users\User\AppData\Local\pylint\pylint\Cache\pylint-crash-2022-08-09-13.txt'.
pylint-crash-2022-08-09-13.txt (and when running pylint example.py):
Traceback (most recent call last):
File "c:\Users\User\example\venv\lib\site-packages\astroid\nodes\scoped_nodes\scoped_nodes.py", line 2663, in igetattr
attributes = self.getattr(name, context, class_context=class_context)
File "c:\Users\User\example\venv\lib\site-packages\astroid\nodes\scoped_nodes\scoped_nodes.py", line 2603, in getattr
raise AttributeInferenceError(
astroid.exceptions.AttributeInferenceError: '__slots__' not found on <ClassDef.Foo l.2 at 0x13232ba3220>.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "c:\Users\User\example\venv\lib\site-packages\pylint\lint\pylinter.py", line 727, in _check_file
check_astroid_module(ast_node)
File "c:\Users\User\example\venv\lib\site-packages\pylint\lint\pylinter.py", line 926, in check_astroid_module
retval = self._check_astroid_module(
File "c:\Users\User\example\venv\lib\site-packages\pylint\lint\pylinter.py", line 976, in _check_astroid_module
walker.walk(node)
File "c:\Users\User\example\venv\lib\site-packages\pylint\utils\ast_walker.py", line 93, in walk
self.walk(child)
File "c:\Users\User\example\venv\lib\site-packages\pylint\utils\ast_walker.py", line 90, in walk
callback(astroid)
File "c:\Users\User\example\venv\lib\site-packages\pylint\checkers\classes\class_checker.py", line 838, in visit_classdef
self._check_slots(node)
File "c:\Users\User\example\venv\lib\site-packages\pylint\checkers\classes\class_checker.py", line 1369, in _check_slots
for slots in node.igetattr("__slots__"):
File "c:\Users\User\example\venv\lib\site-packages\astroid\nodes\scoped_nodes\scoped_nodes.py", line 2714, in igetattr
raise InferenceError(
astroid.exceptions.InferenceError: '__slots__' not found on <ClassDef.Foo l.2 at 0x13232ba3220>.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "c:\Users\User\example\venv\lib\site-packages\pylint\lint\pylinter.py", line 684, in _check_files
self._check_file(get_ast, check_astroid_module, file)
File "c:\Users\User\example\venv\lib\site-packages\pylint\lint\pylinter.py", line 729, in _check_file
raise astroid.AstroidError from e
astroid.exceptions.AstroidError
Expected behavior
Expected: pylint does not crash and either empty output, or some kind of warning or error that I'm defining but not assigning to a __slots__ attribute.
Pylint version
pylint 2.14.5
astroid 2.11.7
Python 3.10.4 (tags/v3.10.4:9d38120, Mar 23 2022, 23:13:41) [MSC v.1929 64 bit (AMD64)]
jacobtylerwalls
added
Crash 💥
A bug that makes pylint crash
Needs PR
This issue is accepted, sufficiently specified and now needs an implementation
and removed
Needs triage 📥
Just created, needs acknowledgment, triage, and proper labelling
labels
Aug 9, 2022
jacobtylerwalls
changed the title
Pylint 2.14.5 on python 3.10.4 crashes fatally after defining a class __slots__ without assigning a value to it
Crash when providing type annotation for class __slots__ without assigning a value
Aug 9, 2022
mbyrnepr2
added a commit
to mbyrnepr2/pylint
that referenced
this issue
Aug 10, 2022
Bug description
Pylint crashes fatally when linting a file with the following example code:
example.py
pylint crashed with a
AstroidError
and with the following stacktrace:A hotfix to my code is simply to assign a value to
__slots__
in the class definition.Expecting pylint not to crash and an empty output or warning/error telling that I am using a defined but unassigned
__slots__
.Configuration
No response
Command used
Pylint output
In the editor:
pylint-crash-2022-08-09-13.txt (and when running
pylint example.py
):Expected behavior
Expected: pylint does not crash and either empty output, or some kind of warning or error that I'm defining but not assigning to a
__slots__
attribute.Pylint version
OS / Environment
No response
Additional dependencies
astroid==2.11.7
colorama==0.4.5
dill==0.3.5.1
isort==5.10.1
lazy-object-proxy==1.7.1
mccabe==0.7.0
platformdirs==2.5.2
pylint==2.14.5
tomli==2.0.1
tomlkit==0.11.2
wrapt==1.14.1
The text was updated successfully, but these errors were encountered: