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 11import 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+ }
214
315/**
416 * 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_ {
7486 or
7587 exists ( Module m | m = this .getEnclosingScope ( ) and m .isPublic ( ) |
7688 /* If the module has an __all__, is this in it */
77- not exists ( m . getAnExport ( ) )
89+ not exists ( getAModuleExport ( m ) )
7890 or
79- m . getAnExport ( ) = this .getName ( )
91+ getAModuleExport ( m ) = this .getName ( )
8092 )
8193 or
8294 exists ( Class c | c = this .getEnclosingScope ( ) |
You can’t perform that action at this time.
0 commit comments