bsddb code updated to version 4.7.3pre2. This code is the same than
Python 2.6 one, since the intention is to keep an unified 2.x/3.x
codebase.

The Python code is automatically translated using "2to3". Please, do not
update this code in Python 3.0 by hand. Update the 2.6 one and then do
"2to3".
diff --git a/Lib/bsddb/dbobj.py b/Lib/bsddb/dbobj.py
index 4c0f125..299e9db 100644
--- a/Lib/bsddb/dbobj.py
+++ b/Lib/bsddb/dbobj.py
@@ -21,12 +21,24 @@
 # added to _bsddb.c.
 #
 
-from . import db
+import sys
+absolute_import = (sys.version_info[0] >= 3)
+if absolute_import :
+    # Because this syntaxis is not valid before Python 2.5
+    exec("from . import db")
+else :
+    from . import db
 
-try:
-    from collections import MutableMapping
-except ImportError:
-    class MutableMapping: pass
+if sys.version_info[0:2] <= (2, 5) :
+    try:
+        from UserDict import DictMixin
+    except ImportError:
+        # DictMixin is new in Python 2.3
+        class DictMixin: pass
+    MutableMapping = DictMixin
+else :
+    import collections
+    MutableMapping = collections.MutableMapping
 
 class DBEnv:
     def __init__(self, *args, **kwargs):
@@ -95,9 +107,8 @@
     def set_get_returns_none(self, *args, **kwargs):
         return self._cobj.set_get_returns_none(*args, **kwargs)
 
-    if db.version() >= (4,0):
-        def log_stat(self, *args, **kwargs):
-            return self._cobj.log_stat(*args, **kwargs)
+    def log_stat(self, *args, **kwargs):
+        return self._cobj.log_stat(*args, **kwargs)
 
     if db.version() >= (4,1):
         def dbremove(self, *args, **kwargs):
@@ -115,7 +126,7 @@
 class DB(MutableMapping):
     def __init__(self, dbenv, *args, **kwargs):
         # give it the proper DBEnv C object that its expecting
-        self._cobj = db.DB(dbenv._cobj, *args, **kwargs)
+        self._cobj = db.DB(*(dbenv._cobj,) + args, **kwargs)
 
     # TODO are there other dict methods that need to be overridden?
     def __len__(self):
@@ -126,8 +137,10 @@
         self._cobj[key] = value
     def __delitem__(self, arg):
         del self._cobj[arg]
-    def __iter__(self):
-        return iter(self.keys())
+
+    if sys.version_info[0:2] >= (2, 6) :
+        def __iter__(self) :
+            return self._cobj.__iter__()
 
     def append(self, *args, **kwargs):
         return self._cobj.append(*args, **kwargs)
@@ -163,8 +176,6 @@
         return self._cobj.key_range(*args, **kwargs)
     def has_key(self, *args, **kwargs):
         return self._cobj.has_key(*args, **kwargs)
-    def __contains__(self, key):
-        return self._cobj.has_key(key)
     def items(self, *args, **kwargs):
         return self._cobj.items(*args, **kwargs)
     def keys(self, *args, **kwargs):