Author: Raffael Tfirst <raffael.tfi...@gmail.com>
Branch: py3.5
Changeset: r85501:17c11ede8071
Date: 2016-07-01 19:46 +0200
http://bitbucket.org/pypy/pypy/changeset/17c11ede8071/

Log:    Check multiple values for keyword in map_unpack_with_call

diff --git a/pypy/interpreter/pyopcode.py b/pypy/interpreter/pyopcode.py
--- a/pypy/interpreter/pyopcode.py
+++ b/pypy/interpreter/pyopcode.py
@@ -1356,8 +1356,19 @@
     def BUILD_MAP_UNPACK_WITH_CALL(self, itemcount, next_instr):
         num_maps = itemcount & 0xff
         w_dict = self.space.newdict()
-        import pdb; pdb.set_trace()
-        self.BUILD_MAP_UNPACK(num_maps, next_instr)
+        for i in range(num_maps, 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()
+                if self.space.is_true(self.space.contains(w_dict,w_key)):
+                    raise oefmt(self.space.w_TypeError,
+                        "got multiple values for keyword argument %s", w_key)
+                self.space.setitem(w_dict, w_key, w_value)
+        while num_maps != 0:
+            self.popvalue()
+            num_maps -= 1
+        self.pushvalue(w_dict)
         
     def BUILD_MAP_UNPACK(self, itemcount, next_instr):
         w_dict = self.space.newdict()
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to