-
Notifications
You must be signed in to change notification settings - Fork 239
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
133: Visit functions in while test #186
Merged
bcaller
merged 5 commits into
python-security:master
from
adrianbn:133_while_test_with_func
Nov 21, 2018
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e704c21
133: Visit functions in while test
adrianbn effd872
133: Support for LHS functions and no comparison while tests
adrianbn b52a870
133: Fix style and complexity issues for Travis.ci
adrianbn 6d25eae
133: Finished tests
adrianbn 9cb0b56
133: Avoid mutating node.test.comparators
adrianbn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,6 @@ | ||
def foo(): | ||
return True | ||
|
||
while foo(): | ||
print(x) | ||
x += 1 |
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,6 @@ | ||
def foo(): | ||
return 6 | ||
|
||
while foo() > x: | ||
print(x) | ||
x += 1 |
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,6 @@ | ||
def foo(): | ||
return 6 | ||
|
||
while x < foo(): | ||
print(x) | ||
x += 1 |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this was already here, but I don't understand why
get_call_names_as_string(comp_n.func) in self.function_names
is there. It means thatrange
is ignored for instance. I'd be tempted to remove it, but maybe in a later PR.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't pay much mind to this detail but if removed, 4 of the test cases or
for
fail due to functions in the iter node being ignored (e.g.range
).I think the rationale here is to only link the while / for node to the function node if we've visited the function before, but I'm not sure why that would matter since we're immediately visiting the call node.
That said, we don't have a
visit_Call
method, so the default visitor will be invoked, which will in turn callvisit_Name
(which we don't have, so default again), then I think a call tovisit_Load
which will be default again, etc. I wonder if we'd need avisit_Call
to handle this case before we can safely remove thein self.function_names
.