-
-
Notifications
You must be signed in to change notification settings - Fork 307
Closed
Milestone
Description
Bug description
When parsing the following a.py:
class A():
def a(self):
desc = f"" + 'a'
return descCommand used
pylint a.pyPylint output
pylint crashed with a ``AstroidError`` and with the following stacktrace:
Traceback (most recent call last):
File "/Users/xuzhangxuan/.pyenv/versions/3.11.10/envs/pylint_debug/lib/python3.11/site-packages/pylint/lint/pylinter.py", line 788, in _lint_file
check_astroid_module(module)
File "/Users/xuzhangxuan/.pyenv/versions/3.11.10/envs/pylint_debug/lib/python3.11/site-packages/pylint/lint/pylinter.py", line 1020, in check_astroid_module
retval = self._check_astroid_module(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/xuzhangxuan/.pyenv/versions/3.11.10/envs/pylint_debug/lib/python3.11/site-packages/pylint/lint/pylinter.py", line 1072, in _check_astroid_module
walker.walk(node)
File "/Users/xuzhangxuan/.pyenv/versions/3.11.10/envs/pylint_debug/lib/python3.11/site-packages/pylint/utils/ast_walker.py", line 90, in walk
self.walk(child)
File "/Users/xuzhangxuan/.pyenv/versions/3.11.10/envs/pylint_debug/lib/python3.11/site-packages/pylint/utils/ast_walker.py", line 90, in walk
self.walk(child)
File "/Users/xuzhangxuan/.pyenv/versions/3.11.10/envs/pylint_debug/lib/python3.11/site-packages/pylint/utils/ast_walker.py", line 87, in walk
callback(astroid)
File "/Users/xuzhangxuan/.pyenv/versions/3.11.10/envs/pylint_debug/lib/python3.11/site-packages/pylint/checkers/classes/special_methods_checker.py", line 183, in visit_functiondef
inferred = _safe_infer_call_result(node, node)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/xuzhangxuan/.pyenv/versions/3.11.10/envs/pylint_debug/lib/python3.11/site-packages/pylint/checkers/classes/special_methods_checker.py", line 42, in _safe_infer_call_result
value = next(inferit)
^^^^^^^^^^^^^
File "/Users/xuzhangxuan/.pyenv/versions/3.11.10/envs/pylint_debug/lib/python3.11/site-packages/astroid/nodes/scoped_nodes/scoped_nodes.py", line 1658, in infer_call_result
yield from returnnode.value.infer(context)
File "/Users/xuzhangxuan/.pyenv/versions/3.11.10/envs/pylint_debug/lib/python3.11/site-packages/astroid/nodes/node_ng.py", line 168, in infer
for i, result in enumerate(self._infer(context=context, **kwargs)):
File "/Users/xuzhangxuan/.pyenv/versions/3.11.10/envs/pylint_debug/lib/python3.11/site-packages/astroid/decorators.py", line 86, in inner
yield next(generator)
^^^^^^^^^^^^^^^
File "/Users/xuzhangxuan/.pyenv/versions/3.11.10/envs/pylint_debug/lib/python3.11/site-packages/astroid/decorators.py", line 49, in wrapped
for res in _func(node, context, **kwargs):
File "/Users/xuzhangxuan/.pyenv/versions/3.11.10/envs/pylint_debug/lib/python3.11/site-packages/astroid/bases.py", line 177, in _infer_stmts
for inf in stmt.infer(context=context):
File "/Users/xuzhangxuan/.pyenv/versions/3.11.10/envs/pylint_debug/lib/python3.11/site-packages/astroid/nodes/node_ng.py", line 168, in infer
for i, result in enumerate(self._infer(context=context, **kwargs)):
File "/Users/xuzhangxuan/.pyenv/versions/3.11.10/envs/pylint_debug/lib/python3.11/site-packages/astroid/decorators.py", line 86, in inner
yield next(generator)
^^^^^^^^^^^^^^^
File "/Users/xuzhangxuan/.pyenv/versions/3.11.10/envs/pylint_debug/lib/python3.11/site-packages/astroid/decorators.py", line 49, in wrapped
for res in _func(node, context, **kwargs):
File "/Users/xuzhangxuan/.pyenv/versions/3.11.10/envs/pylint_debug/lib/python3.11/site-packages/astroid/bases.py", line 177, in _infer_stmts
for inf in stmt.infer(context=context):
File "/Users/xuzhangxuan/.pyenv/versions/3.11.10/envs/pylint_debug/lib/python3.11/site-packages/astroid/nodes/node_ng.py", line 168, in infer
for i, result in enumerate(self._infer(context=context, **kwargs)):
File "/Users/xuzhangxuan/.pyenv/versions/3.11.10/envs/pylint_debug/lib/python3.11/site-packages/astroid/decorators.py", line 69, in inner
yield next(generator)
^^^^^^^^^^^^^^^
File "/Users/xuzhangxuan/.pyenv/versions/3.11.10/envs/pylint_debug/lib/python3.11/site-packages/astroid/decorators.py", line 49, in wrapped
for res in _func(node, context, **kwargs):
File "/Users/xuzhangxuan/.pyenv/versions/3.11.10/envs/pylint_debug/lib/python3.11/site-packages/astroid/nodes/_base_nodes.py", line 336, in _filter_operation_errors
for result in infer_callable(context):
File "/Users/xuzhangxuan/.pyenv/versions/3.11.10/envs/pylint_debug/lib/python3.11/site-packages/astroid/nodes/node_classes.py", line 1555, in _infer_binop
yield from self._infer_binary_operation(
File "/Users/xuzhangxuan/.pyenv/versions/3.11.10/envs/pylint_debug/lib/python3.11/site-packages/astroid/nodes/_base_nodes.py", line 641, in _infer_binary_operation
left_type = helpers.object_type(left)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/xuzhangxuan/.pyenv/versions/3.11.10/envs/pylint_debug/lib/python3.11/site-packages/astroid/helpers.py", line 106, in object_type
types = set(_object_type(node, context))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/xuzhangxuan/.pyenv/versions/3.11.10/envs/pylint_debug/lib/python3.11/site-packages/astroid/helpers.py", line 68, in _object_type
for inferred in node.infer(context=context):
^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'infer'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/xuzhangxuan/.pyenv/versions/3.11.10/envs/pylint_debug/lib/python3.11/site-packages/pylint/lint/pylinter.py", line 752, in _lint_files
self._lint_file(fileitem, module, check_astroid_module)
File "/Users/xuzhangxuan/.pyenv/versions/3.11.10/envs/pylint_debug/lib/python3.11/site-packages/pylint/lint/pylinter.py", line 790, in _lint_file
raise astroid.AstroidError from e
astroid.exceptions.AstroidErrorExpected behavior
No crash.
Pylint version
pylint 3.3.5
astroid 3.3.9
Python 3.11.10 (main, Mar 11 2025, 10:34:09) [Clang 16.0.0 (clang-1600.0.26.6)]OS / Environment
darwin (Darwin)
Metadata
Metadata
Assignees
Labels
No labels