Skip to content

Commit e2a3e2e

Browse files
committed
only let PYTHONPATH override site module
1 parent 3358fee commit e2a3e2e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/ImpModuleBuiltins.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,8 +466,12 @@ protected ArgumentClinicProvider getArgumentClinic() {
466466
@Specialization
467467
boolean run(String name) {
468468
// if PYTHONPATH is set, it is prepended to the sys.path on startup and thus might
469-
// override any frozen modules from the stdlib
470-
return getContext().getOption(PythonOptions.PythonPath).isEmpty() && findFrozen(name).status == FROZEN_OKAY;
469+
// override the site module from the stdlib
470+
if (!getContext().getOption(PythonOptions.PythonPath).isEmpty() && "site".equals(name)) {
471+
return false;
472+
} else {
473+
return findFrozen(name).status == FROZEN_OKAY;
474+
}
471475
}
472476
}
473477

0 commit comments

Comments
 (0)