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

Python: Support flow through import * #7246

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

@tausbn
Copy link
Contributor

@tausbn tausbn commented Nov 26, 2021

Adds results for ModuleVariableNode::getARead corresponding to reads
that go through (chains of) import *.

This required a bit of a change to which module variables we define.
Previously, we only included variables that were accessed elsewhere in
the same file, but now we must ensure to also include variables that may
be accessed through import *.


Can be reviewed commit-by-commit, though be aware that the second commit not only moves stuff around, but also refactores and renames a bunch of predicates (so as to make them possible to expose publically). For that reason, it's probably best to review that commit as if it's an entirely new implementation. I apologise for the inconvenience.

For figuring out which module is referred to when writing from ... import *, I used the existing points-to machinery. It's possible this could be replaced with logic that doesn't depend on points-to, but in the short term this seemed like the easiest solution for a precise module resolution.

I don't think this needs a change note, but I'll be happy to add one if the reviewer(s) think otherwise.

tausbn added 3 commits Nov 26, 2021
This test shows off a few things:

- transitive chains of `import *`
- multiple modules exporting the same name (to test for cross-talk)
Moves this from the API graphs implementation into separate files.
Adds result for `ModuleVariableNode::getARead` corresponding to reads
that go through (chains of) `import *`.

This required a bit of a change to _which_ module variables we define.
Previously, we only included variables that were accessed elsewhere in
the same file, but now we must ensure to also include variables that may
be accessed through `import *`.
Turns out that now we can resolve the convoluted imports. Hurray!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

1 participant