Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 53f8591

Browse files
committed
Python points-to: Fix attribute lookup for packages.
1 parent 4a03fd0 commit 53f8591

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

python/ql/src/semmle/python/types/ModuleObject.qll

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ private import semmle.python.types.ModuleKind
66
abstract class ModuleObject extends Object {
77

88
ModuleValue theModule() {
9-
result.getSource() = this
9+
result.(PythonModuleObjectInternal).getSourceModule() = this.getModule()
10+
or
11+
result.(PackageObjectInternal).getFolder() = this.(PackageObject).getPath()
12+
or
13+
result.(BuiltinModuleObjectInternal).getBuiltin() = this
1014
}
1115

1216
/** Gets the scope corresponding to this module, if this is a Python module */
@@ -223,7 +227,7 @@ class PackageObject extends ModuleObject {
223227

224228
override Object getAttribute(string name) {
225229
exists(Value val |
226-
theModule().(PackageObjectInternal).attribute(name, _, _) and
230+
theModule().(PackageObjectInternal).attribute(name, val, _) and
227231
result = val.getSource()
228232
)
229233
}

0 commit comments

Comments
 (0)