Skip to content

Commit 245aab9

Browse files
committed
Fix PyTraceBackPrintNode to not pass null to nodes
* Notably null is forbidden for Truffle libraries.
1 parent 6a81328 commit 245aab9

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1572,7 +1572,7 @@ protected void printException(MaterializedFrame frame, PythonModule sys, Object
15721572
// only print colon if the str() of the object is not the empty string
15731573
v = objectStr(frame, value);
15741574
TruffleString s = tryCastToString(v);
1575-
if (v == null) {
1575+
if (v == PNone.NONE) {
15761576
fileWriteString(frame, out, ": <exception str() failed>");
15771577
} else if (!PGuards.isString(v) || (s != null && !s.isEmpty())) {
15781578
fileWriteString(frame, out, ": ");

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/lib/PyTraceBackPrintNode.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public static boolean fileWriteObject(VirtualFrame frame, Object file, Object da
109109
} else {
110110
value = objectRepr(frame, data);
111111
}
112-
if (value == null) {
112+
if (value == PNone.NONE) {
113113
return false;
114114
}
115115
fileWriteString(frame, file, castToString(value));
@@ -142,7 +142,7 @@ public static Object objectStr(VirtualFrame frame, Node inliningTarget, Object v
142142
try {
143143
return strAsObjectNode.execute(frame, inliningTarget, value);
144144
} catch (PException pe) {
145-
return null;
145+
return PNone.NONE;
146146
}
147147
}
148148

0 commit comments

Comments
 (0)