[pypy-svn] r78741 - pypy/branch/fast-forward/lib_pypy

afa at codespeak.net afa at codespeak.net
Fri Nov 5 14:31:06 CET 2010


Author: afa
Date: Fri Nov  5 14:31:05 2010
New Revision: 78741

Modified:
   pypy/branch/fast-forward/lib_pypy/dbm.py
Log:
Implement dbm.__contains__ to help tests that now call "key in db"
instead of the outdated "db.has_key(key)"


Modified: pypy/branch/fast-forward/lib_pypy/dbm.py
==============================================================================
--- pypy/branch/fast-forward/lib_pypy/dbm.py	(original)
+++ pypy/branch/fast-forward/lib_pypy/dbm.py	Fri Nov  5 14:31:05 2010
@@ -90,7 +90,7 @@
             raise error("cannot add item to database")
         return default
 
-    def has_key(self, key):
+    def __contains__(self, key):
         if not self._aobj:
             raise error('DBM object has already been closed')
         dat = datum(key)
@@ -98,6 +98,7 @@
         if k.dptr:
             return True
         return False
+    has_key = __contains__
 
     def __delitem__(self, key):
         if not self._aobj:



More information about the Pypy-commit mailing list