Author: Armin Rigo <ar...@tunes.org>
Branch: py3.5
Changeset: r89983:1a6695039c97
Date: 2017-02-06 19:50 +0100
http://bitbucket.org/pypy/pypy/changeset/1a6695039c97/

Log:    hg merge default

diff --git a/pypy/doc/extending.rst b/pypy/doc/extending.rst
--- a/pypy/doc/extending.rst
+++ b/pypy/doc/extending.rst
@@ -14,7 +14,7 @@
 
 * Write them in C++ and bind them through  :doc:`cppyy <cppyy>` using Cling.
 
-* Write them in as `RPython mixed modules`_.
+* Write them as `RPython mixed modules`_.
 
 
 CFFI
diff --git a/pypy/objspace/std/dictmultiobject.py 
b/pypy/objspace/std/dictmultiobject.py
--- a/pypy/objspace/std/dictmultiobject.py
+++ b/pypy/objspace/std/dictmultiobject.py
@@ -1013,7 +1013,10 @@
         if self.is_correct_type(w_key):
             d = self.unerase(w_dict.dstorage)
             key = self.unwrap(w_key)
-            objectmodel.move_to_end(d, key, last_flag)
+            try:
+                objectmodel.move_to_end(d, key, last_flag)
+            except KeyError:
+                w_dict.space.raise_key_error(w_key)
         else:
             self.switch_to_object_strategy(w_dict)
             w_dict.nondescr_move_to_end(w_dict.space, w_key, last_flag)
diff --git a/pypy/objspace/std/test/test_dictmultiobject.py 
b/pypy/objspace/std/test/test_dictmultiobject.py
--- a/pypy/objspace/std/test/test_dictmultiobject.py
+++ b/pypy/objspace/std/test/test_dictmultiobject.py
@@ -292,6 +292,7 @@
                     assert list(d) == other_keys + [key]
                 else:
                     assert list(d) == [key] + other_keys
+                raises(KeyError, __pypy__.move_to_end, d, key * 3, last=last)
 
     def test_delitem_if_value_is(self):
         import __pypy__
diff --git a/rpython/rlib/objectmodel.py b/rpython/rlib/objectmodel.py
--- a/rpython/rlib/objectmodel.py
+++ b/rpython/rlib/objectmodel.py
@@ -783,6 +783,9 @@
     def setdefault(self, key, default):
         return self._dict.setdefault(_r_dictkey(self, key), default)
 
+    def pop(self, key, *default):
+        return self._dict.pop(_r_dictkey(self, key), *default)
+
     def popitem(self):
         dk, value = self._dict.popitem()
         return dk.key, value
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to