Skip to content

Commit 75f4051

Browse files
committed
Python: Fix hasLocationInfo for packages
1 parent 75262dd commit 75f4051

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

python/ql/src/semmle/python/Files.qll

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,12 @@ class Location extends @location {
415415
locations_ast(this, m, startline, startcolumn, endline, endcolumn)
416416
)
417417
)
418+
or
419+
// Packages have no suitable filepath, so we use just the path instead.
420+
exists(Module m | not exists(m.getFile()) |
421+
filepath = m.getPath().getAbsolutePath() and
422+
locations_ast(this, m, startline, startcolumn, endline, endcolumn)
423+
)
418424
}
419425
}
420426

0 commit comments

Comments
 (0)