Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

RecursionError: maximum recursion depth exceeded #358

Open
ericwb opened this issue May 17, 2024 · 5 comments
Open

RecursionError: maximum recursion depth exceeded #358

ericwb opened this issue May 17, 2024 · 5 comments

Comments

@ericwb
Copy link

ericwb commented May 17, 2024

I tested out vulture on a project I maintain (Bandit). Unfortunately, the first result I got was a RecursionError. It's not clear to me if this is by-design or an edge case bug. Bandit itself does static analysis using an AST and vulture seems to trip up when inspecting the visitor logic.

To reproduce:

pip install vulture
git clone https://github.com/PyCQA/bandit
cd bandit
vulture .
  File "/Users/ericwb/workspace/reflex-web/venv/lib/python3.12/site-packages/vulture/core.py", line 721, in generic_visit
    self.visit(value)
  File "/Users/ericwb/workspace/reflex-web/venv/lib/python3.12/site-packages/vulture/core.py", line 687, in visit
    return self.generic_visit(node)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ericwb/workspace/reflex-web/venv/lib/python3.12/site-packages/vulture/core.py", line 721, in generic_visit
    self.visit(value)
  File "/Users/ericwb/workspace/reflex-web/venv/lib/python3.12/site-packages/vulture/core.py", line 672, in visit
    visitor(node)
  File "/Users/ericwb/workspace/reflex-web/venv/lib/python3.12/site-packages/vulture/core.py", line 521, in visit_BinOp
    utils.is_ast_string(node.left)
RecursionError: maximum recursion depth exceeded
@jendrikseipp
Copy link
Owner

Thanks for the report! This is definitely not by design. Happy to review a PR if you take the time to tackle this.

@ericwb
Copy link
Author

ericwb commented May 17, 2024

Looks like this isn't occurring on Bandit source code, but one of its dependencies in the .tox directory.

Narrowing it down some, it occurs here:
vulture .tox/py312/lib/python3.12/site-packages/astroid

@ericwb
Copy link
Author

ericwb commented May 17, 2024

More specifically, it's this file:
vulture bandit/.tox/py312/lib/python3.12/site-packages/astroid/tests/testdata/python3/data/joined_strings.py

@ericwb
Copy link
Author

ericwb commented May 17, 2024

Here's a reference issue in astroid. So this might be an extreme edge case that doesn't need fixing. However, it would be nice if the RecursionError was caught and handled gracefully in vulture.

pylint-dev/astroid#557

@jendrikseipp
Copy link
Owner

Thanks for looking into this! Can you make a pull request along those lines?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants