Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

RecursionError with hundreds of consecutive function calls #2525

Open
correctmost opened this issue Aug 26, 2024 · 0 comments
Open

RecursionError with hundreds of consecutive function calls #2525

correctmost opened this issue Aug 26, 2024 · 0 comments

Comments

@correctmost
Copy link
Contributor

Steps to reproduce

The following code triggers a RecursionError in astroid:

a()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()

This bug was discovered by OSS-Fuzz:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=64104 (report not public yet)

Current behavior

Exception on node <Call l.1 at 0x77b464c1d5b0> in file 'corpus/a.py'
Traceback (most recent call last):
  File "pylint/pylint/utils/ast_walker.py", line 91, in walk
    callback(astroid)
  File "pylint/pylint/checkers/refactoring/refactoring_checker.py", line 1161, in visit_call
    self._check_use_list_literal(node)
  File "pylint/pylint/checkers/refactoring/refactoring_checker.py", line 1712, in _check_use_list_literal
    if node.as_string() == "list()":
       ^^^^^^^^^^^^^^^^
  File "astroid/astroid/nodes/node_ng.py", line 619, in as_string
    return AsStringVisitor()(self)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "astroid/astroid/nodes/as_string.py", line 47, in __call__
    return node.accept(self).replace(DOC_NEWLINE, "\n")
           ^^^^^^^^^^^^^^^^^
  File "astroid/astroid/nodes/node_ng.py", line 238, in accept
    return func(self)
           ^^^^^^^^^^

[...snip...]

  File "astroid/astroid/nodes/as_string.py", line 164, in visit_call
    expr_str = self._precedence_parens(node, node.func)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "astroid/astroid/nodes/as_string.py", line 73, in _precedence_parens
    return child.accept(self)
           ^^^^^^^^^^^^^^^^^^
  File "astroid/astroid/nodes/node_ng.py", line 238, in accept
    return func(self)
           ^^^^^^^^^^
  File "astroid/astroid/nodes/as_string.py", line 164, in visit_call
    expr_str = self._precedence_parens(node, node.func)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "astroid/astroid/nodes/as_string.py", line 70, in _precedence_parens
    if self._should_wrap(node, child, is_left):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "astroid/astroid/nodes/as_string.py", line 80, in _should_wrap
    node_precedence = node.op_precedence()
                      ^^^^^^^^^^^^^^^^^^^^
RecursionError: maximum recursion depth exceeded

Expected behavior

No crash

Version

d8dbc46

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

6 participants
@Pierre-Sassoulas @correctmost and others