File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/dict Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 69
69
import com .oracle .graal .python .builtins .objects .method .PMethod ;
70
70
import com .oracle .graal .python .builtins .objects .object .PythonObjectLibrary ;
71
71
import com .oracle .graal .python .builtins .objects .str .PString ;
72
+ import com .oracle .graal .python .builtins .objects .tuple .PTuple ;
72
73
import com .oracle .graal .python .builtins .objects .type .LazyPythonClass ;
73
74
import com .oracle .graal .python .builtins .objects .type .PythonBuiltinClass ;
74
75
import com .oracle .graal .python .nodes .ErrorMessages ;
@@ -228,8 +229,11 @@ public abstract static class PopItemNode extends PythonUnaryBuiltinNode {
228
229
@ Specialization (limit = "3" )
229
230
public Object popItem (PDict dict ,
230
231
@ CachedLibrary ("dict.getDictStorage()" ) HashingStorageLibrary lib ) {
231
- for (DictEntry entry : lib .entries (dict .getDictStorage ())) {
232
- return factory ().createTuple (new Object []{entry .getKey (), entry .getValue ()});
232
+ HashingStorage storage = dict .getDictStorage ();
233
+ for (DictEntry entry : lib .entries (storage )) {
234
+ PTuple result = factory ().createTuple (new Object []{entry .getKey (), entry .getValue ()});
235
+ lib .delItem (storage , entry .getKey ());
236
+ return result ;
233
237
}
234
238
throw raise (KeyError , ErrorMessages .IS_EMPTY , "popitem(): dictionary" );
235
239
}
You can’t perform that action at this time.
0 commit comments