Skip to content

Commit b4f694d

Browse files
committed
Make GraalHPyBoolFromBool accept Java boolean
1 parent 63b4681 commit b4f694d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/hpy/GraalHPyContextFunctions.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,9 +1196,14 @@ static Object doGeneric(@SuppressWarnings("unused") Object hpyContext, Object ar
11961196
public abstract static class GraalHPyBoolFromBool extends HPyBinaryContextFunction {
11971197

11981198
@Specialization
1199-
static PInt doGeneric(GraalHPyContext hpyContext, byte value) {
1199+
static PInt doBoolean(GraalHPyContext hpyContext, boolean value) {
12001200
Python3Core core = hpyContext.getContext();
1201-
return value != 0 ? core.getTrue() : core.getFalse();
1201+
return value ? core.getTrue() : core.getFalse();
1202+
}
1203+
1204+
@Specialization
1205+
static PInt doByte(GraalHPyContext hpyContext, byte value) {
1206+
return doBoolean(hpyContext, value != 0);
12021207
}
12031208
}
12041209

0 commit comments

Comments
 (0)