[pypy-commit] pypy default: Test and fix.

arigo noreply at buildbot.pypy.org
Sun Jul 3 11:47:29 CEST 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r45316:f1a93c5db828
Date: 2011-07-03 11:55 +0200
http://bitbucket.org/pypy/pypy/changeset/f1a93c5db828/

Log:	Test and fix.

diff --git a/pypy/objspace/std/mapdict.py b/pypy/objspace/std/mapdict.py
--- a/pypy/objspace/std/mapdict.py
+++ b/pypy/objspace/std/mapdict.py
@@ -670,6 +670,8 @@
 
     def popitem(self, w_dict):
         curr = self.unerase(w_dict.dstorage)._get_mapdict_map().search(DICT)
+        if curr is None:
+            raise KeyError
         key = curr.selector[0]
         w_value = self.getitem_str(w_dict, key)
         w_key = self.space.wrap(key)
diff --git a/pypy/objspace/std/test/test_mapdict.py b/pypy/objspace/std/test/test_mapdict.py
--- a/pypy/objspace/std/test/test_mapdict.py
+++ b/pypy/objspace/std/test/test_mapdict.py
@@ -479,6 +479,7 @@
         it2 = a.__dict__.popitem()
         assert it2 == ("x", 5)
         assert a.__dict__ == {}
+        raises(KeyError, a.__dict__.popitem)
 
 
 


More information about the pypy-commit mailing list