-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
AstroidRelated to astroidRelated to astroidCrash 💥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
Description
Recursive defining a function with classmethod decorator triggers a fatal error.
pylint_example.py
class C:
pass
@classmethod
def foo(cls, a):
b = super(C, cls).foo(a)
return b
The expected behavior:
No fatal error.
Pylint output
>> pylint 'pylint_example.py'
************* Module pylint_example
pylint_example.py:69:0: C0115: Missing class docstring (missing-class-docstring)
pylint_example.py:69:0: C0103: Class name "C" doesn't conform to PascalCase naming style (invalid-name)
pylint_example.py:69:0: R0903: Too few public methods (0/2) (too-few-public-methods)
pylint_example.py:73:0: C0116: Missing function or method docstring (missing-function-docstring)
pylint_example.py:73:0: C0104: Disallowed name "foo" (disallowed-name)
pylint_example.py:73:13: C0103: Argument name "a" doesn't conform to snake_case naming style (invalid-name)
Exception on node <Assign l.74 at 0x7f105a5fa450> in file '/home/xxm/Desktop/pylint_example.py'
Traceback (most recent call last):
File "/home/xxm/.local/lib/python3.11/site-packages/astroid/inference_tip.py", line 54, in inner
yield from _cache[func, node, context]
~~~~~~^^^^^^^^^^^^^^^^^^^^^
KeyError: (<function register_builtin_transform.<locals>._transform_wrapper at 0x7f105dd2f380>, <Call l.74 at 0x7f105a5fa810>, <astroid.context.InferenceContext object at 0x7f105a60d240>)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/xxm/.local/lib/python3.11/site-packages/pylint/checkers/utils.py", line 1341, in safe_infer
value = next(infer_gen)
^^^^^^^^^^^^^^^
File "/home/xxm/.local/lib/python3.11/site-packages/astroid/nodes/node_ng.py", line 166, in infer
yield from self._infer(context=context, **kwargs)
File "/home/xxm/.local/lib/python3.11/site-packages/astroid/decorators.py", line 90, in inner
yield next(generator)
^^^^^^^^^^^^^^^
File "/home/xxm/.local/lib/python3.11/site-packages/astroid/decorators.py", line 49, in wrapped
for res in _func(node, context, **kwargs):
File "/home/xxm/.local/lib/python3.11/site-packages/astroid/inference.py", line 374, in infer_attribute
for owner in self.expr.infer(context):
File "/home/xxm/.local/lib/python3.11/site-packages/astroid/nodes/node_ng.py", line 153, in infer
for result in self._explicit_inference(
File "/home/xxm/.local/lib/python3.11/site-packages/astroid/inference_tip.py", line 66, in inner
func(node, context, **kwargs)
File "/home/xxm/.local/lib/python3.11/site-packages/astroid/brain/brain_builtin_inference.py", line 177, in _transform_wrapper
result = transform(node, context=context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/xxm/.local/lib/python3.11/site-packages/astroid/brain/brain_builtin_inference.py", line 441, in infer_super
assert cls is not None
^^^^^^^^^^^^^^^
AssertionError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/xxm/.local/lib/python3.11/site-packages/pylint/utils/ast_walker.py", line 91, in walk
callback(astroid)
File "/home/xxm/.local/lib/python3.11/site-packages/pylint/checkers/refactoring/refactoring_checker.py", line 1524, in visit_assign
self._append_context_managers_to_stack(node)
File "/home/xxm/.local/lib/python3.11/site-packages/pylint/checkers/refactoring/refactoring_checker.py", line 1579, in _append_context_managers_to_stack
inferred = utils.safe_infer(value.func)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/xxm/.local/lib/python3.11/site-packages/pylint/checkers/utils.py", line 1345, in safe_infer
raise AstroidError from e
astroid.exceptions.AstroidError
pylint_example.py:1:0: F0002: /home/xxm/Desktop/pylint_example.py: Fatal error while checking '/home/xxm/Desktop/pylint_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 '/home/xxm/.cache/pylint/pylint-crash-2023-06-09-15-30-18.txt'. (astroid-error)
------------------------------------------------------------------
Your code has been rated at 0.00/10 (previous run: 0.00/10, +0.00)
Test Environment:
pylint 3.0.0b1
astroid 3.0.0a5-dev0
Python 3.11.3
Ubuntu 18.04
Gallaecio
Metadata
Metadata
Assignees
Labels
AstroidRelated to astroidRelated to astroidCrash 💥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