Merge pull request #4467 from tausbn/python-fix-import-type-tracking

Python: Fix unwanted module type tracking
This commit is contained in:
Rasmus Wriedt Larsen
2020-10-14 13:08:57 +02:00
committed by GitHub
3 changed files with 10 additions and 7 deletions

View File

@@ -68,5 +68,5 @@ Node importNode(string name) {
// Because named imports are modelled as `AttrRead`s, the statement `from foo import bar as baz`
// is interpreted as if it was an assignment `baz = foo.bar`, which means `baz` gets tracked as a
// reference to `foo.bar`, as desired.
result.asCfgNode().getNode() = any(ImportExpr i | i.getAnImportedModuleName() = name)
result.asCfgNode().getNode() = any(ImportExpr i | i.getName() = name)
}