Skip to content

Commit 3554042

Browse files
committed
don't try to import site when nosite was given
1 parent 151c746 commit 3554042

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

graalpython/com.oracle.graal.python.shell/src/com/oracle/graal/python/shell/GraalPythonMain.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -666,16 +666,18 @@ public int readEvalPrint(Context context, ConsoleHandler consoleHandler) {
666666
break;
667667
}
668668
} catch (EOFException e) {
669-
try {
670-
evalInternal(context, "import site; exit()\n");
671-
} catch (PolyglotException e2) {
672-
if (e2.isExit()) {
673-
// don't use the exit code from the PolyglotException
674-
return lastStatus;
675-
} else if (e2.isCancelled()) {
676-
continue;
669+
if (!noSite) {
670+
try {
671+
evalInternal(context, "import site; exit()\n");
672+
} catch (PolyglotException e2) {
673+
if (e2.isExit()) {
674+
// don't use the exit code from the PolyglotException
675+
return lastStatus;
676+
} else if (e2.isCancelled()) {
677+
continue;
678+
}
679+
throw new RuntimeException("error while calling exit", e);
677680
}
678-
throw new RuntimeException("error while calling exit", e);
679681
}
680682
System.out.println();
681683
return lastStatus;

0 commit comments

Comments
 (0)