mirror of
https://github.com/github/codeql.git
synced 2026-04-25 16:55:19 +02:00
Merge pull request #21459 from github/tausbn/python-fix-missing-relative-imports
Python: Fix resolution of relative imports from namespace packages
This commit is contained in:
@@ -17,6 +17,10 @@ private predicate valid_module_name(string name) {
|
||||
exists(Module m | m.getName() = name)
|
||||
or
|
||||
exists(Builtin cmod | cmod.getClass() = Builtin::special("ModuleType") and cmod.getName() = name)
|
||||
or
|
||||
// Namespace packages may not have a corresponding Module entity,
|
||||
// but their names are still valid for the purpose of import resolution.
|
||||
name = moduleNameFromFile(any(Folder f))
|
||||
}
|
||||
|
||||
/** An artificial expression representing an import */
|
||||
|
||||
Reference in New Issue
Block a user