Skip to content

Commit 8f70c9f

Browse files
committed
Python: add comment about namespace packages
1 parent 307f443 commit 8f70c9f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

python/ql/lib/semmle/python/Module.qll

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,14 @@ private predicate isPotentialPackage(Folder f) {
195195
}
196196

197197
private string moduleNameFromBase(Container file) {
198+
// We used to also require `isPotentialPackage(f)` to hold in this case,
199+
// but we saw modules not getting resolved because their folder did not
200+
// contain an `__init__.py` file.
201+
//
202+
// This makes the folder not be a package but a namespace package instead.
203+
//
204+
// It is possible that we can keep the requirement here, but relax
205+
// `isPotentialPackage` itself to allow for namespace packages.
198206
result = file.getBaseName()
199207
or
200208
file instanceof File and result = file.getStem()

0 commit comments

Comments
 (0)