[pypy-svn] r72350 - in pypy/trunk/pypy/module/__pypy__: . test
xoraxax at codespeak.net
xoraxax at codespeak.net
Thu Mar 18 07:09:56 CET 2010
Author: xoraxax
Date: Thu Mar 18 07:09:54 2010
New Revision: 72350
Modified:
pypy/trunk/pypy/module/__pypy__/interp_identitydict.py
pypy/trunk/pypy/module/__pypy__/test/test_identitydict.py
Log:
Add delitem to identity dict.
Modified: pypy/trunk/pypy/module/__pypy__/interp_identitydict.py
==============================================================================
--- pypy/trunk/pypy/module/__pypy__/interp_identitydict.py (original)
+++ pypy/trunk/pypy/module/__pypy__/interp_identitydict.py Thu Mar 18 07:09:54 2010
@@ -34,6 +34,13 @@
except KeyError:
raise OperationError(space.w_KeyError, w_key)
+ @unwrap_spec('self', ObjSpace, W_Root)
+ def descr_delitem(self, space, w_key):
+ try:
+ del self.dict[w_key]
+ except KeyError:
+ raise OperationError(space.w_KeyError, w_key)
+
@unwrap_spec('self', ObjSpace, W_Root, W_Root)
def get(self, space, w_key, w_default=None):
return self.dict.get(w_key, w_default)
@@ -61,6 +68,7 @@
__contains__ = interp2app(W_IdentityDict.descr_contains),
__setitem__ = interp2app(W_IdentityDict.descr_setitem),
__getitem__ = interp2app(W_IdentityDict.descr_getitem),
+ __delitem__ = interp2app(W_IdentityDict.descr_delitem),
get = interp2app(W_IdentityDict.get),
keys = interp2app(W_IdentityDict.keys),
values = interp2app(W_IdentityDict.values),
Modified: pypy/trunk/pypy/module/__pypy__/test/test_identitydict.py
==============================================================================
--- pypy/trunk/pypy/module/__pypy__/test/test_identitydict.py (original)
+++ pypy/trunk/pypy/module/__pypy__/test/test_identitydict.py Thu Mar 18 07:09:54 2010
@@ -14,6 +14,7 @@
assert d
assert len(d) == 3
+ del d[0]
d.clear()
assert not d
More information about the Pypy-commit
mailing list