Skip to content

Commit e779a69

Browse files
committed
always exclude the __graalpython__.list_files builtin when building without platform access
1 parent ce7922c commit e779a69

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ public void postInitialize(Python3Core core) {
256256
mod.setAttribute(tsLiteral("dump_heap"), PNone.NO_VALUE);
257257
mod.setAttribute(tsLiteral("is_native_object"), PNone.NO_VALUE);
258258
}
259-
if (!context.getOption(PythonOptions.RunViaLauncher)) {
259+
if (PythonOptions.WITHOUT_PLATFORM_ACCESS || !context.getOption(PythonOptions.RunViaLauncher)) {
260260
mod.setAttribute(tsLiteral("list_files"), PNone.NO_VALUE);
261261
}
262262
}
@@ -959,6 +959,9 @@ abstract static class ListFiles extends PythonBinaryBuiltinNode {
959959
@TruffleBoundary
960960
@Specialization
961961
Object list(TruffleString dirPath, TruffleString filesListPath) {
962+
if (PythonOptions.WITHOUT_PLATFORM_ACCESS) {
963+
throw CompilerDirectives.shouldNotReachHere();
964+
}
962965
print(getContext().getStandardOut(), String.format("listing files from '%s' to '%s'\n", dirPath, filesListPath));
963966

964967
TruffleFile dir = getContext().getPublicTruffleFileRelaxed(dirPath);

0 commit comments

Comments
 (0)