Skip to content

Commit d60014d

Browse files
committed
don't fail when the root node doesn't have a source section
1 parent f77ee5d commit d60014d

File tree

1 file changed

+6
-1
lines changed
  • graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/code

1 file changed

+6
-1
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/code/CodeBuiltins.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,12 @@ public abstract static class LinenoNode extends PythonBuiltinNode {
103103
@TruffleBoundary
104104
protected Object doIt(PythonParseResult self) {
105105
RootNode rootNode = self.getRootNode();
106-
return rootNode.getSourceSection().getStartLine();
106+
SourceSection sourceSection = rootNode.getSourceSection();
107+
if (sourceSection == null) {
108+
return 1;
109+
} else {
110+
return sourceSection.getStartLine();
111+
}
107112
}
108113
}
109114

0 commit comments

Comments
 (0)