-
Notifications
You must be signed in to change notification settings - Fork 2k
Python: Clean up LocalSourceNode charpred
#6204
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
Merged
RasmusWL
merged 2 commits into
github:main
from
tausbn:python-ensmallen-localsourcenode
Jul 13, 2021
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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 hidden or 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.
Uh oh!
There was an error while loading. Please reload this page.
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.
Thanks for adding these comments, makes it much easier 👍
Are there any instances where having
ModuleVariableNodeprovides any value instead of just havingany(ModuleVariableNode mvn).getARead()? That is, could we write this part as:I tried running the following query on a few databases I had lying around (salt, nova, peewee), but it did not give any results.
I guess I could just try to run our tests with that change, so I've just started doing that 😛
Uh oh!
There was an error while loading. Please reload this page.
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 just tried out running the tests, and some of them failed. For example
codeql/python/ql/test/experimental/dataflow/ApiGraphs/test.py
Line 50 in 6823855
and the query above doesn't give any results either, so clearly that query is not good enough 😓
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.
The trouble arises when you want to type track from
some_global = trackedtosink(some_global). In practice this happens in two steps: first we go fromtrackedtoModuleVariableNode for some_globaland then from this node to the read.However, since type trackers (in their usual formulation) step from
LocalSourceNodetoLocalSourceNode, we'll lose the first step unless theModuleVariableNodeis also aLocalSourceNode.On the other hand, we should eventually be able to get rid of the
getAReadbit. It's only there right now because we have local flow into global variables, which I think we should get rid of (but we do want it in the global scope, so this is slightly tricky).For instance we currently have local flow from source to sink in the following bit of code:
Now, we'll actually have this regardless (unless we put some effort into tracking what globals are modified by what functions, which we might), since there will be the aforementioned step through the module variable node. But we shouldn't have local flow here.
I think based on this discussion that I should maybe expand the comment for
ModuleVariableNodea bit. 😅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.
#6218 (which is based on this branch) clarifies this situation a bit by creating a specific
TypeTrackingNodeclass that encompasses bothLocalSourceNodeandModuleVariableNode. That way, we don't have the somewhat confusing inclusion ofModuleVariableNodeas aLocalSourceNode.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.
Should this PR be closed then, and we focus on the other one instead?
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 think it makes more sense to merge this one as is (assuming you're happy with it), as the changes it makes have been tested (performance and otherwise), whereas the performance tests for the other PR are still ongoing. Also, the other changes will affect the shared type tracking library, so are perhaps a bit more controversial.
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.
alright, fine by me 👍