Skip to content

Commit ae46be0

Browse files
committed
return True and False constants as views for booleans
1 parent fdf8362 commit ae46be0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/PythonLanguage.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,13 @@ protected Object getLanguageView(PythonContext context, Object value) {
323323
return value;
324324
}
325325
PythonObjectFactory uncached = PythonObjectFactory.getUncached();
326-
if (value instanceof Byte) {
326+
if (value instanceof Boolean) {
327+
if ((boolean) value) {
328+
return context.getCore().getTrue();
329+
} else {
330+
return context.getCore().getFalse();
331+
}
332+
} else if (value instanceof Byte) {
327333
return uncached.createInt(PythonBuiltinClassType.PInt, (byte) value);
328334
} else if (value instanceof Character) {
329335
return uncached.createString(Character.toString((char) value));

0 commit comments

Comments
 (0)