Skip to content

Commit 36b62ba

Browse files
committed
PBaseDictIterator: fix size changed during iteration exception raising
This reverts commit 4201773b19d96e6b63d69d16655640a5d33cfacd.
1 parent 4384e43 commit 36b62ba

File tree

1 file changed

+5
-0
lines changed
  • graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/iterator

1 file changed

+5
-0
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/iterator/IteratorBuiltins.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,13 @@ public Object next(PStringIterator self) {
177177

178178
@Specialization
179179
public Object next(PDictView.PBaseDictIterator<?> self,
180+
@Cached ConditionProfile sizeChanged,
181+
@CachedLibrary(limit = "3") HashingStorageLibrary storageLibrary,
180182
@Cached ConditionProfile profile) {
181183
if (profile.profile(self.hasNext())) {
184+
if (sizeChanged.profile(self.checkSizeChanged(storageLibrary))) {
185+
throw raise(RuntimeError, ErrorMessages.CHANGED_SIZE_DURING_ITERATION, "dictionary");
186+
}
182187
return self.next(factory());
183188
}
184189
throw raise(PythonErrorType.StopIteration);

0 commit comments

Comments
 (0)