Skip to content

Commit 99a477d

Browse files
committed
Fix fallback specialization in SequenceStorageNodes#RepeatNode
1 parent a55dac3 commit 99a477d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/common/SequenceStorageNodes.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2542,7 +2542,8 @@ SequenceStorage doGeneric(SequenceStorage s, int times,
25422542
@Cached("create()") LenNode lenNode) {
25432543
try {
25442544
int len = lenNode.execute(s);
2545-
SequenceStorage repeated = createEmptyNode.execute(s, Math.multiplyExact(len, times), -1);
2545+
int newLen = Math.multiplyExact(len, times);
2546+
SequenceStorage repeated = createEmptyNode.execute(s, newLen, -1);
25462547

25472548
for (int i = 0; i < len; i++) {
25482549
setItemNode.execute(repeated, i, getGetItemNode().execute(s, i));
@@ -2555,6 +2556,7 @@ SequenceStorage doGeneric(SequenceStorage s, int times,
25552556
}
25562557
}
25572558

2559+
repeated.setNewLength(newLen);
25582560
return repeated;
25592561
} catch (OutOfMemoryError | ArithmeticException e) {
25602562
outOfMemProfile.enter();

0 commit comments

Comments
 (0)