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 on long elif #71

Open
thatch opened this issue Jun 24, 2019 · 0 comments
Open

RecursionError on long elif #71

thatch opened this issue Jun 24, 2019 · 0 comments

Comments

@thatch
Copy link

thatch commented Jun 24, 2019

Given

def func(x):
    if x == "a":
        return "a"
    elif x == "a":
        return "a"
    elif x == "a":
        return "a"
    elif x == "a":
        return "a"
    elif x == "a":  # repeat elif/return 160 times total
        return "a"

We get the error when running flake8 on it:

ERROR:1:1: X002 File "flake8/main/cli.py", line 16, in main   
ERROR:1:1: X002 File "flake8/main/application.py", line 412, in run
ERROR:1:1: X002 File "flake8/main/application.py", line 400, in _run
ERROR:1:1: X002 File "flake8/main/application.py", line 318, in run_checks
ERROR:1:1: X002 File "flake8/checker.py", line 340, in run    
ERROR:1:1: X002 File "flake8/checker.py", line 324, in run_serial
ERROR:1:1: X002 File "flake8/checker.py", line 612, in run_checks
ERROR:1:1: X002 File "flake8/checker.py", line 520, in run_ast_checks
ERROR:1:1: X002 File "mccabe.py", line 266, in run            
ERROR:1:1: X002 File "mccabe.py", line 47, in preorder        
ERROR:1:1: X002 File "mccabe.py", line 41, in dispatch        
ERROR:1:1: X002 File "mccabe.py", line 167, in default        
ERROR:1:1: X002 File "mccabe.py", line 31, in default         
ERROR:1:1: X002 File "mccabe.py", line 41, in dispatch        
ERROR:1:1: X002 File "mccabe.py", line 135, in visitFunctionDef
ERROR:1:1: X002 File "mccabe.py", line 111, in dispatch_list       
ERROR:1:1: X002 File "mccabe.py", line 41, in dispatch
ERROR:1:1: X002 File "mccabe.py", line 177, in visitIf
ERROR:1:1: X002 File "mccabe.py", line 190, in _subgraph
ERROR:1:1: X002 File "mccabe.py", line 204, in _subgraph_parse
ERROR:1:1: X002 File "mccabe.py", line 111, in dispatch_list
...
ERROR:1:1: X002 File "mccabe.py", line 177, in visitIf
ERROR:1:1: X002 File "mccabe.py", line 190, in _subgraph
ERROR:1:1: X002 File "mccabe.py", line 204, in _subgraph_parse
ERROR:1:1: X002 File "mccabe.py", line 111, in dispatch_list
ERROR:1:1: X002 File "mccabe.py", line 41, in dispatch
ERROR:1:1: X002 File "mccabe.py", line 177, in visitIf
ERROR:1:1: X002 File "mccabe.py", line 190, in _subgraph
ERROR:1:1: X002 File "mccabe.py", line 204, in _subgraph_parse
ERROR:1:1: X002 File "mccabe.py", line 111, in dispatch_list
ERROR:1:1: X002 File "mccabe.py", line 41, in dispatch
ERROR:1:1: X002 File "mccabe.py", line 177, in visitIf
ERROR:1:1: X002 File "mccabe.py", line 190, in _subgraph
ERROR:1:1: X002 File "mccabe.py", line 196, in _subgraph_parse
ERROR:1:1: X002 File "mccabe.py", line 111, in dispatch_list
ERROR:1:1: X002 File "mccabe.py", line 41, in dispatch
ERROR:1:1: X002 RecursionError: maximum recursion depth exceeded
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

1 participant