Skip to content

Commit 5e50075

Browse files
committed
fix cast in HAS_SIZE MR
1 parent ca6aeb8 commit 5e50075

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/runtime/interop/PythonMessageResolution.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,13 @@ public Object access(Object object) {
626626
return false;
627627
} else if (getIsSequenceNode().execute(profiled)) {
628628
// also try to access using an integer index
629-
int len = (int) getUnboxNode().execute(getLenNode().executeWith(profiled));
629+
Object size = getUnboxNode().execute(getLenNode().executeWith(profiled));
630+
int len = 0;
631+
if (size instanceof Integer) {
632+
len = (int) size;
633+
} else if (size instanceof Long) {
634+
len = ((Long) size).intValue();
635+
}
630636
if (len > 0) {
631637
try {
632638
getCallGetItemNode().executeObject(profiled, 0);

0 commit comments

Comments
 (0)