File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
python/ql/src/semmle/python Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -212,8 +212,15 @@ private string moduleNameFromBase(Container file) {
212
212
private predicate transitively_imported_from_entry_point ( File file ) {
213
213
file .getExtension ( ) .matches ( "%py%" ) and
214
214
exists ( File importer |
215
+ // Only consider files that are in the source archive
216
+ exists ( importer .getRelativePath ( ) ) and
215
217
importer .getParent ( ) = file .getParent ( ) and
216
- exists ( ImportExpr i | i .getLocation ( ) .getFile ( ) = importer and i .getName ( ) = file .getStem ( ) )
218
+ exists ( ImportExpr i |
219
+ i .getLocation ( ) .getFile ( ) = importer and
220
+ i .getName ( ) = file .getStem ( ) and
221
+ // Disregard relative imports
222
+ i .getLevel ( ) = 0
223
+ )
217
224
|
218
225
importer .isPossibleEntryPoint ( ) or transitively_imported_from_entry_point ( importer )
219
226
)
You can’t perform that action at this time.
0 commit comments