pylint-dev/astroid

Exception 'RecursionError: maximum recursion depth exceeded' in astroid decorators with astroid 3.1.0

Closed this issue · 1 comments

In our CI pylint recently started consistently crashing with the following exception when parsing the following file:
https://github.com/rhinstaller/anaconda/blob/master/pyanaconda/modules/subscription/subscription.py

I can't reproduce it outside of the CI, so sorry for not providing a reproducer. I hope the traceback has enough hints to trace this regression.

The package versions used are the following:

pylint == 3.1.0
astroid == 3.1.0
python == 3.12

=========================
Exception on node <Call l.601 at 0x7fd7e2c7a120> in file '/tmp/anaconda/pyanaconda/modules/subscription/subscription.py'
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/astroid/decorators.py", line 90, in inner
    yield next(generator)
          ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/astroid/decorators.py", line 49, in wrapped
    for res in _func(node, context, **kwargs):
  File "/usr/local/lib/python3.12/site-packages/astroid/bases.py", line 177, in _infer_stmts
    for inf in stmt.infer(context=context):
  File "/usr/local/lib/python3.12/site-packages/astroid/nodes/node_ng.py", line 169, in infer
    limit = AstroidManager().max_inferable_values
            ^^^^^^^^^^^^^^^^
RecursionError: maximum recursion depth exceeded
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/pylint/utils/ast_walker.py", line 91, in walk
    callback(astroid)
  File "/usr/local/lib/python3.12/site-packages/pylint/checkers/base/basic_checker.py", line 708, in visit_call
    if utils.is_terminating_func(node):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pylint/checkers/utils.py", line 2160, in is_terminating_func
    for inferred in node.func.infer():
  File "/usr/local/lib/python3.12/site-packages/astroid/nodes/node_ng.py", line 170, in infer
    for i, result in enumerate(self._infer(context=context, **kwargs)):
  File "/usr/local/lib/python3.12/site-packages/astroid/decorators.py", line 103, in inner
    yield from generator
  File "/usr/local/lib/python3.12/site-packages/astroid/decorators.py", line 49, in wrapped
    for res in _func(node, context, **kwargs):
  File "/usr/local/lib/python3.12/site-packages/astroid/nodes/node_classes.py", line 1090, in _infer_attribute
    for owner in node.expr.infer(context):
  File "/usr/local/lib/python3.12/site-packages/astroid/nodes/node_ng.py", line 170, in infer
    for i, result in enumerate(self._infer(context=context, **kwargs)):
  File "/usr/local/lib/python3.12/site-packages/astroid/decorators.py", line 103, in inner
    yield from generator
  File "/usr/local/lib/python3.12/site-packages/astroid/decorators.py", line 49, in wrapped
    for res in _func(node, context, **kwargs):
  File "/usr/local/lib/python3.12/site-packages/astroid/bases.py", line 177, in _infer_stmts
    for inf in stmt.infer(context=context):
  File "/usr/local/lib/python3.12/site-packages/astroid/nodes/node_ng.py", line 170, in infer
    for i, result in enumerate(self._infer(context=context, **kwargs)):
  File "/usr/local/lib/python3.12/site-packages/astroid/decorators.py", line 103, in inner
    yield from generator
  File "/usr/local/lib/python3.12/site-packages/astroid/decorators.py", line 49, in wrapped
    for res in _func(node, context, **kwargs):
  File "/usr/local/lib/python3.12/site-packages/astroid/bases.py", line 177, in _infer_stmts
    for inf in stmt.infer(context=context):
  File "/usr/local/lib/python3.12/site-packages/astroid/nodes/node_ng.py", line 170, in infer
    for i, result in enumerate(self._infer(context=context, **kwargs)):

Thanks for the report. Sorry you encountered this newly in 3.1. Will be handling as part of pylint-dev/pylint#9139