-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
AstroidRelated to astroidRelated to astroidCrash 💥A bug that makes pylint crashA bug that makes pylint crash
Milestone
Description
Bug description
When parsing the following file:
from azure.core import CaseInsensitiveEnumMeta
from enum import Enum
from six import with_metaclass
class PetEnumPy2Metaclass(with_metaclass(CaseInsensitiveEnumMeta, Enum)):
DOG = "dog"pylint crashed with a TypeError and with the following stacktrace:
Traceback (most recent call last):
File "C:\Users\travi\.pyenv\pyenv-win\versions\3.10.2\lib\site-packages\pylint\lint\pylinter.py", line 1034, in _check_files
self._check_file(get_ast, check_astroid_module, file)
File "C:\Users\travi\.pyenv\pyenv-win\versions\3.10.2\lib\site-packages\pylint\lint\pylinter.py", line 1069, in _check_file
check_astroid_module(ast_node)
File "C:\Users\travi\.pyenv\pyenv-win\versions\3.10.2\lib\site-packages\pylint\lint\pylinter.py", line 1203, in check_astroid_module
retval = self._check_astroid_module(
File "C:\Users\travi\.pyenv\pyenv-win\versions\3.10.2\lib\site-packages\pylint\lint\pylinter.py", line 1250, in _check_astroid_module
walker.walk(node)
File "C:\Users\travi\.pyenv\pyenv-win\versions\3.10.2\lib\site-packages\pylint\utils\ast_walker.py", line 75, in walk
self.walk(child)
File "C:\Users\travi\.pyenv\pyenv-win\versions\3.10.2\lib\site-packages\pylint\utils\ast_walker.py", line 75, in walk
self.walk(child)
File "C:\Users\travi\.pyenv\pyenv-win\versions\3.10.2\lib\site-packages\pylint\utils\ast_walker.py", line 75, in walk
self.walk(child)
File "C:\Users\travi\.pyenv\pyenv-win\versions\3.10.2\lib\site-packages\pylint\utils\ast_walker.py", line 72, in walk
callback(astroid)
File "C:\Users\travi\.pyenv\pyenv-win\versions\3.10.2\lib\site-packages\pylint\checkers\base.py", line 1994, in visit_assignname
if not list(frame.local_attr_ancestors(node.name)):
File "C:\Users\travi\.pyenv\pyenv-win\versions\3.10.2\lib\site-packages\astroid\nodes\scoped_nodes\scoped_nodes.py", line 2606, in local_attr_ancestors
if name in astroid:
TypeError: argument of type 'Const' is not iterable
Configuration
No response
Command used
`python -m pylint ..\apistubgentest`Pylint output
************* Module apistubgentest.apistubgentest.models._models
F:\repos\azure-sdk-tools\packages\python-packages\apistubgentest\apistubgentest\models\_models.py:38:0: C0301: Line too long (110/100) (line-too-long)
F:\repos\azure-sdk-tools\packages\python-packages\apistubgentest\apistubgentest\models\_models.py:147:0: C0301: Line too long (110/100) (line-too-long)
F:\repos\azure-sdk-tools\packages\python-packages\apistubgentest\apistubgentest\models\_models.py:1:0: C0114: Missing module docstring (missing-module-docstring)
F:\repos\azure-sdk-tools\packages\python-packages\apistubgentest\apistubgentest\models\_models.py:17:0: C0115: Missing class docstring (missing-class-docstring)
F:\repos\azure-sdk-tools\packages\python-packages\apistubgentest\apistubgentest\models\_models.py:18:4: C0203: Metaclass method __getitem__ should have 'cls' as first argument (bad-mcs-method-argument)
F:\repos\azure-sdk-tools\packages\python-packages\apistubgentest\apistubgentest\models\_models.py:29:0: W0613: Unused argument 'kwargs' (unused-argument)
F:\repos\azure-sdk-tools\packages\python-packages\apistubgentest\apistubgentest\models\_models.py:29:4: R0201: Method could be a function (no-self-use)
F:\repos\azure-sdk-tools\packages\python-packages\apistubgentest\apistubgentest\models\_models.py:25:0: R0903: Too few public methods (1/2) (too-few-public-methods)
Exception on node <AssignName.DOG l.48 at 0x1c284a02770> in file 'F:\repos\azure-sdk-tools\packages\python-packages\apistubgentest\apistubgentest\models\_models.py'
Traceback (most recent call last):
File "C:\Users\travi\.pyenv\pyenv-win\versions\3.10.2\lib\site-packages\pylint\utils\ast_walker.py", line 72, in walk
callback(astroid)
File "C:\Users\travi\.pyenv\pyenv-win\versions\3.10.2\lib\site-packages\pylint\checkers\base.py", line 1994, in visit_assignname
if not list(frame.local_attr_ancestors(node.name)):
File "C:\Users\travi\.pyenv\pyenv-win\versions\3.10.2\lib\site-packages\astroid\nodes\scoped_nodes\scoped_nodes.py", line 2606, in local_attr_ancestors
if name in astroid:
TypeError: argument of type 'Const' is not iterable
F:\repos\azure-sdk-tools\packages\python-packages\apistubgentest\apistubgentest\models\_models.py:1:0: F0001: Fatal error while checking '..\apistubgentest\apistubgentest\models\_models.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\travi\AppData\Local\pylint\pylint\Cache\pylint-crash-2022-03-18-09.txt'. (fatal)
------------------------------------------------------------------
Your code has been rated at 5.68/10 (previous run: 8.50/10, -2.82)Expected behavior
Not crash
Pylint version
Python 3.10.2
pylint 2.12.2
astroid 2.9.3OS / Environment
Windows 10/11. CMD shell.
Additional dependencies
azure-core
six
kashifkhan
Metadata
Metadata
Assignees
Labels
AstroidRelated to astroidRelated to astroidCrash 💥A bug that makes pylint crashA bug that makes pylint crash