Skip to content

Commit 20e5683

Browse files
committed
sys.excepthook - missing TruffleBoundary
1 parent a3b2e31 commit 20e5683

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

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

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,20 +1037,26 @@ private static String getIndent(int indent) {
10371037
return PythonUtils.sbToString(sb);
10381038
}
10391039

1040-
void displaySourceLine(VirtualFrame frame, Object out, String fileName, int lineNo, int indent) {
1040+
@TruffleBoundary
1041+
CharSequence getSourceLine(String fileName, int lineNo) {
10411042
final PythonContext context = getContext();
10421043
TruffleFile file = context.getEnv().getInternalTruffleFile(fileName);
10431044
final Source source;
10441045
try {
10451046
source = PythonLanguage.newSource(context, file, fileName);
1046-
final CharSequence line = source.getCharacters(lineNo);
1047-
print(frame, out, getIndent(indent));
1048-
print(frame, out, PythonUtils.trimLeft(line));
1049-
print(frame, out, "\n");
1050-
} catch (IOException ignored) {
1047+
return source.getCharacters(lineNo);
1048+
} catch (IOException ioe) {
1049+
return null;
10511050
}
10521051
}
10531052

1053+
void displaySourceLine(VirtualFrame frame, Object out, String fileName, int lineNo, int indent) {
1054+
final CharSequence line = getSourceLine(fileName, lineNo);
1055+
print(frame, out, getIndent(indent));
1056+
print(frame, out, PythonUtils.trimLeft(line));
1057+
print(frame, out, "\n");
1058+
}
1059+
10541060
void printInternal(VirtualFrame frame, Object out, PTraceback traceback, long limit) {
10551061
int depth = 0;
10561062
String lastFile = null;

0 commit comments

Comments
 (0)