Python points-to: Fix up some oddities with nested from ... import *.

This commit is contained in:
Mark Shannon
2019-06-24 11:55:50 +01:00
parent a917019915
commit 9bf67e19c2

View File

@@ -177,13 +177,8 @@ class PackageObjectInternal extends ModuleObjectInternal, TPackageObject {
or
exists(Module init |
init = this.getSourceModule() and
(
/* There is no variable shadowing the name of the child module */
not exists(EssaVariable var | var.getAUse() = init.getANormalExit() and var.getSourceVariable().getName() = name)
or
/* The variable shadowing the name of the child module is undefined at exit */
ModuleAttributes::pointsToAtExit(init, name, ObjectInternal::undefined(), _)
) and
/* The variable shadowing the name of the child module is undefined at exit */
ModuleAttributes::pointsToAtExit(init, name, ObjectInternal::undefined(), _) and
not name = "__init__" and
value = this.submodule(name) and
origin = CfgOrigin::fromObject(value)
@@ -249,6 +244,7 @@ class PythonModuleObjectInternal extends ModuleObjectInternal, TPythonModule {
}
pragma [noinline] override predicate attribute(string name, ObjectInternal value, CfgOrigin origin) {
value != ObjectInternal::undefined() and
ModuleAttributes::pointsToAtExit(this.getSourceModule(), name, value, origin)
}