Author: Raffael Tfirst <[email protected]>
Branch: py3.5
Changeset: r85410:5997558702eb
Date: 2016-06-27 19:22 +0200
http://bitbucket.org/pypy/pypy/changeset/5997558702eb/
Log: Implement map_unpack opcode
diff --git a/pypy/interpreter/pyopcode.py b/pypy/interpreter/pyopcode.py
--- a/pypy/interpreter/pyopcode.py
+++ b/pypy/interpreter/pyopcode.py
@@ -1369,8 +1369,19 @@
self.pushvalue(w_sum)
def BUILD_MAP_UNPACK(self, itemcount, next_instr):
- w_sum = self.unpack_helper(itemcount, next_instr)
- self.pushvalue(self.space.newdict(w_sum))
+ w_dict = self.space.newdict()
+ for i in range(itemcount, 0, -1):
+ w_item = self.peekvalue(i-1)
+ num_items = w_item.length()
+ for j in range(num_items):
+ (w_key, w_value) = w_item.popitem()
+ self.space.setitem(w_dict, w_key, w_value)
+ while itemcount != 0:
+ self.popvalue()
+ itemcount -= 1
+ self.pushvalue(w_dict)
+
+
### ____________________________________________________________ ###
class ExitFrame(Exception):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit