Commit 48605be1 authored by R. David Murray's avatar R. David Murray

Issue 7975: in python 2.6 bsddb.dbshelve switched from DictMixin to

MutableMapping, and thereby lost functionality because the replacement
functionality was implemented incorrectly or incompletely).  Since bsddb
isn't in py3k, this patch just goes back to using DictMixin in order to
correct the regression.
parent 300c5cc8
...@@ -59,16 +59,11 @@ else: ...@@ -59,16 +59,11 @@ else:
return cPickle.dumps(object, bin=protocol) return cPickle.dumps(object, bin=protocol)
if sys.version_info[0:2] <= (2, 5) : try:
try:
from UserDict import DictMixin from UserDict import DictMixin
except ImportError: except ImportError:
# DictMixin is new in Python 2.3 # DictMixin is new in Python 2.3
class DictMixin: pass class DictMixin: pass
MutableMapping = DictMixin
else :
import collections
MutableMapping = collections.MutableMapping
#------------------------------------------------------------------------ #------------------------------------------------------------------------
...@@ -111,7 +106,7 @@ def open(filename, flags=db.DB_CREATE, mode=0660, filetype=db.DB_HASH, ...@@ -111,7 +106,7 @@ def open(filename, flags=db.DB_CREATE, mode=0660, filetype=db.DB_HASH,
class DBShelveError(db.DBError): pass class DBShelveError(db.DBError): pass
class DBShelf(MutableMapping): class DBShelf(DictMixin):
"""A shelf to hold pickled objects, built upon a bsddb DB object. It """A shelf to hold pickled objects, built upon a bsddb DB object. It
automatically pickles/unpickles data objects going to/from the DB. automatically pickles/unpickles data objects going to/from the DB.
""" """
...@@ -162,10 +157,6 @@ class DBShelf(MutableMapping): ...@@ -162,10 +157,6 @@ class DBShelf(MutableMapping):
else: else:
return self.db.keys() return self.db.keys()
if sys.version_info[0:2] >= (2, 6) :
def __iter__(self) :
return self.db.__iter__()
def open(self, *args, **kwargs): def open(self, *args, **kwargs):
self.db.open(*args, **kwargs) self.db.open(*args, **kwargs)
......
...@@ -30,6 +30,8 @@ Core and Builtins ...@@ -30,6 +30,8 @@ Core and Builtins
Library Library
------- -------
- Issue #7975: correct regression in dict methods supported by bsddb.dbshelve.
- Issue #7959: ctypes callback functions are now registered correctly - Issue #7959: ctypes callback functions are now registered correctly
with the cylce garbage collector. with the cylce garbage collector.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment