Skip to content

Commit 136213f

Browse files
committed
Fix castStr.execute could be null.
1 parent 21ab5ea commit 136213f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/PythonAbstractObject.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1761,10 +1761,13 @@ public String toDisplayString(boolean allowSideEffects,
17611761
}
17621762
toStrAttr = readStr.execute(builtins, names);
17631763
result = castStr.execute(callNode.execute(toStrAttr, this));
1764-
return result;
1765-
} else {
1766-
return toStringImpl();
1764+
// reusing the same condition profile here as it effectively
1765+
// has the same effect.
1766+
if (conditionProfile.profile(result != null)) {
1767+
return result;
1768+
}
17671769
}
1770+
return toStringImpl();
17681771
}
17691772

17701773
@TruffleBoundary

0 commit comments

Comments
 (0)