[pypy-svn] r61174 - pypy/trunk/pypy/lib

fijal at codespeak.net fijal at codespeak.net
Wed Jan 21 00:49:32 CET 2009


Author: fijal
Date: Wed Jan 21 00:49:31 2009
New Revision: 61174

Modified:
   pypy/trunk/pypy/lib/dbm.py
Log:
missing delitem for dbm


Modified: pypy/trunk/pypy/lib/dbm.py
==============================================================================
--- pypy/trunk/pypy/lib/dbm.py	(original)
+++ pypy/trunk/pypy/lib/dbm.py	Wed Jan 21 00:49:31 2009
@@ -124,6 +124,14 @@
             raise error("dbm mappings have string indices only")
         self._set(key, value)
 
+    def __delitem__(self, key):
+        if not isinstance(key, str):
+            raise error("dbm mappings have string indices only")
+        dat = datum()
+        dat.dptr = c_char_p(key)
+        dat.dsize = c_int(len(key))
+        getattr(lib, funcs['delete'])(self._aobj, dat)
+
 # initialization for Berkeley DB
 _bdb_funcs = {
     'open': '__db_ndbm_open',



More information about the Pypy-commit mailing list