Skip to content

Commit d94f0df

Browse files
committed
be a little more clear where we're incomplete in our bin/oct/hex implementation
1 parent fe11052 commit d94f0df

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,15 +311,18 @@ String doO(VirtualFrame frame, Object x,
311311
@Cached BranchProfile isPInt) {
312312
Object index = lib.asIndexWithState(x, PArguments.getThreadState(frame));
313313
if (isSubtype.execute(lib.getLazyPythonClass(index), PythonBuiltinClassType.PInt)) {
314-
if (index instanceof Integer) {
314+
if (index instanceof Boolean || index instanceof Integer) {
315315
isInt.enter();
316-
return doL((int) index);
316+
return doL(lib.asSize(index));
317317
} else if (index instanceof Long) {
318318
isLong.enter();
319319
return doL((long) index);
320320
} else if (index instanceof PInt) {
321321
isPInt.enter();
322322
return doPI((PInt) index);
323+
} else {
324+
CompilerDirectives.transferToInterpreter();
325+
throw raise(PythonBuiltinClassType.NotImplementedError, "bin/oct/hex with native integer subclasses");
323326
}
324327
}
325328
CompilerDirectives.transferToInterpreter();

0 commit comments

Comments
 (0)