[pypy-svn] r78298 - in pypy/branch/set-object-cleanup/pypy/objspace/std: . test
arigo at codespeak.net
arigo at codespeak.net
Tue Oct 26 15:30:43 CEST 2010
Author: arigo
Date: Tue Oct 26 15:30:42 2010
New Revision: 78298
Modified:
pypy/branch/set-object-cleanup/pypy/objspace/std/dictmultiobject.py
pypy/branch/set-object-cleanup/pypy/objspace/std/test/test_dictmultiobject.py
Log:
Test and fix.
Modified: pypy/branch/set-object-cleanup/pypy/objspace/std/dictmultiobject.py
==============================================================================
--- pypy/branch/set-object-cleanup/pypy/objspace/std/dictmultiobject.py (original)
+++ pypy/branch/set-object-cleanup/pypy/objspace/std/dictmultiobject.py Tue Oct 26 15:30:42 2010
@@ -843,6 +843,9 @@
# beginning of the hash table.
iterator = w_dict.iter()
w_key, w_value = iterator.next()
+ if w_key is None:
+ raise OperationError(space.w_KeyError,
+ space.wrap("popitem(): dictionary is empty"))
w_dict.delitem(w_key)
return space.newtuple([w_key, w_value])
Modified: pypy/branch/set-object-cleanup/pypy/objspace/std/test/test_dictmultiobject.py
==============================================================================
--- pypy/branch/set-object-cleanup/pypy/objspace/std/test/test_dictmultiobject.py (original)
+++ pypy/branch/set-object-cleanup/pypy/objspace/std/test/test_dictmultiobject.py Tue Oct 26 15:30:42 2010
@@ -238,6 +238,7 @@
it1 = d.popitem()
assert len(d) == 0
assert (it!=it1) and (it1==(1,2) or it1==(3,4))
+ raises(KeyError, d.popitem)
def test_setdefault(self):
d = {1:2, 3:4}
More information about the Pypy-commit
mailing list