mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
Python: In py/import-own-module handle from foo import *
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
|
||||
import python
|
||||
|
||||
predicate modules_imports_itself(Import i, ModuleValue m) {
|
||||
predicate modules_imports_itself(ImportingStmt i, ModuleValue m) {
|
||||
i.getEnclosingModule() = m.getScope() and
|
||||
m = max(string s, ModuleValue m_ |
|
||||
s = i.getAnImportedModuleName() and
|
||||
@@ -22,6 +22,6 @@ predicate modules_imports_itself(Import i, ModuleValue m) {
|
||||
)
|
||||
}
|
||||
|
||||
from Import i, ModuleValue m
|
||||
from ImportingStmt i, ModuleValue m
|
||||
where modules_imports_itself(i, m)
|
||||
select i, "The module '" + m.getName() + "' imports itself."
|
||||
|
||||
@@ -2,3 +2,4 @@
|
||||
| pkg_notok/__init__.py:4:1:4:16 | Import | The module 'pkg_notok' imports itself. |
|
||||
| pkg_notok/__init__.py:12:1:12:25 | Import | The module 'pkg_notok' imports itself. |
|
||||
| pkg_notok/__init__.py:13:1:13:37 | Import | The module 'pkg_notok' imports itself. |
|
||||
| pkg_notok/__init__.py:14:1:14:23 | from pkg_notok import * | The module 'pkg_notok' imports itself. |
|
||||
|
||||
@@ -11,4 +11,4 @@ import pkg_notok.bar
|
||||
|
||||
from pkg_notok import Foo
|
||||
from pkg_notok import Foo as NotOkFoo
|
||||
from pkg_notok import * # TODO: TN
|
||||
from pkg_notok import *
|
||||
|
||||
Reference in New Issue
Block a user