Python: Disregard packages when looking for cyclic imports.

This commit is contained in:
Taus Brock-Nannestad
2019-10-17 12:47:34 +02:00
parent 9bc7ce1fac
commit 067bdf5ec4
2 changed files with 7 additions and 1 deletions

View File

@@ -21,7 +21,8 @@ predicate circular_import(ModuleValue m1, ModuleValue m2) {
ModuleValue stmt_imports(ImportingStmt s) {
exists(string name | result.importedAs(name) and not name = "__main__" |
name = s.getAnImportedModuleName() and
s.getASubExpression().pointsTo(result)
s.getASubExpression().pointsTo(result) and
not result.isPackage()
)
}