-
Notifications
You must be signed in to change notification settings - Fork 244
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #173 from bcaller/recursion
Recursive function calls shouldn't raise RecursionError
- Loading branch information
Showing
7 changed files
with
62 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from flask import Flask, request | ||
|
||
app = Flask(__name__) | ||
|
||
|
||
def recur_without_any_propagation(x): | ||
if len(x) < 20: | ||
return recur_without_any_propagation("a" * 24) | ||
return "Done" | ||
|
||
|
||
def recur_no_propagation_false_positive(x): | ||
if len(x) < 20: | ||
return recur_no_propagation_false_positive(x + "!") | ||
return "Done" | ||
|
||
|
||
def recur_with_propagation(x): | ||
if len(x) < 20: | ||
return recur_with_propagation(x + "!") | ||
return x | ||
|
||
|
||
@app.route('/recursive') | ||
def route(): | ||
param = request.args.get('param', 'not set') | ||
repeated_completely_untainted = recur_without_any_propagation(param) | ||
app.db.execute(repeated_completely_untainted) | ||
repeated_untainted = recur_no_propagation_false_positive(param) | ||
app.db.execute(repeated_untainted) | ||
repeated_tainted = recur_with_propagation(param) | ||
app.db.execute(repeated_tainted) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters