File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
python/ql/lib/semmle/python Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change 1
1
import python
2
+ private import semmle.python.dataflow.new.internal.ImportResolution
3
+
4
+ /**
5
+ * Gets a name exported by module `m`, that is the names that will be added to a namespace by 'from this-module import *'.
6
+ *
7
+ * This aims to be the same as m.getAnExport(), but without using the points-to machinery.
8
+ */
9
+ private string getAModuleExport ( Module m ) {
10
+ py_exports ( m , result )
11
+ or
12
+ ImportResolution:: module_export ( m , result , _)
13
+ }
2
14
3
15
/**
4
16
* A Scope. A scope is the lexical extent over which all identifiers with the same name refer to the same variable.
@@ -74,9 +86,9 @@ class Scope extends Scope_ {
74
86
or
75
87
exists ( Module m | m = this .getEnclosingScope ( ) and m .isPublic ( ) |
76
88
/* If the module has an __all__, is this in it */
77
- not exists ( m . getAnExport ( ) )
89
+ not exists ( getAModuleExport ( m ) )
78
90
or
79
- m . getAnExport ( ) = this .getName ( )
91
+ getAModuleExport ( m ) = this .getName ( )
80
92
)
81
93
or
82
94
exists ( Class c | c = this .getEnclosingScope ( ) |
You can’t perform that action at this time.
0 commit comments