summaryrefslogtreecommitdiff
path: root/Lib/bsddb/dbshelve.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/bsddb/dbshelve.py')
-rw-r--r--Lib/bsddb/dbshelve.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/bsddb/dbshelve.py b/Lib/bsddb/dbshelve.py
index 8264f2d812..942ee17016 100644
--- a/Lib/bsddb/dbshelve.py
+++ b/Lib/bsddb/dbshelve.py
@@ -38,12 +38,12 @@ if sys.version_info[:3] >= (2, 3, 0):
HIGHEST_PROTOCOL = pickle.HIGHEST_PROTOCOL
def _dumps(object, protocol):
return pickle.dumps(object, protocol=protocol)
- from UserDict import DictMixin
+ from collections import MutableMapping
else:
HIGHEST_PROTOCOL = None
def _dumps(object, protocol):
return pickle.dumps(object, bin=protocol)
- class DictMixin: pass
+ class MutableMapping: pass
from . import db
@@ -90,7 +90,7 @@ def open(filename, flags=db.DB_CREATE, mode=0o660, filetype=db.DB_HASH,
class DBShelveError(db.DBError): pass
-class DBShelf(DictMixin):
+class DBShelf(MutableMapping):
"""A shelf to hold pickled objects, built upon a bsddb DB object. It
automatically pickles/unpickles data objects going to/from the DB.
"""
@@ -141,6 +141,8 @@ class DBShelf(DictMixin):
else:
return self.db.keys()
+ def __iter__(self):
+ return iter(self.keys())
def open(self, *args, **kwargs):
self.db.open(*args, **kwargs)