Closes issue 3776.
Review by Nick Coghlan.
:synopsis: Interface to Berkeley DB database library
.. sectionauthor:: Skip Montanaro <skip@pobox.com>
+.. deprecated:: 2.6
+ The :mod:`bsddb` module has been deprecated for removal in Python 3.0.
+
The :mod:`bsddb` module provides an interface to the Berkeley DB library. Users
can create hash, btree or record based library files using the appropriate open
:synopsis: DBM-style interface to the BSD database library.
.. sectionauthor:: Fred L. Drake, Jr. <fdrake@acm.org>
-.. note::
- The :mod:`dbhash` module has been renamed to :mod:`dbm.bsd` in Python 3.0.
- The :term:`2to3` tool will automatically adapt imports when converting your
- sources to 3.0.
+.. deprecated:: 2.6
+ The :mod:`dbhash` module has been deprecated for removal in Python 3.0.
.. index:: module: bsddb
import sys
absolute_import = (sys.version_info[0] >= 3)
+if sys.py3kwarning:
+ import warnings
+ warnings.warnpy3k("in 3.x, bsddb has been removed; "
+ "please use the pybsddb project instead",
+ DeprecationWarning, 2)
+
try:
if __name__ == 'bsddb3':
# import _pybsddb binary as it should be the more recent version from
"""Provide a (g)dbm-compatible interface to bsddb.hashopen."""
import sys
+if sys.py3kwarning:
+ import warnings
+ warnings.warnpy3k("in 3.x, dbhash has been removed", DeprecationWarning, 2)
try:
import bsddb
except ImportError:
'sunos5' : ('sunaudiodev', 'SUNAUDIODEV'),
}
optional_modules = ('bsddb185', 'Canvas', 'dl', 'linuxaudiodev', 'imageop',
- 'sv', 'cPickle')
+ 'sv', 'cPickle', 'bsddb', 'dbhash')
def check_removal(self, module_name, optional=False):
"""Make sure the specified module, when imported, raises a
wmod = self.module
with wmod.catch_warnings(module=wmod, record=True) as w:
self.assertEqual(w, [])
+ self.assertRaises(AttributeError, getattr, w, 'message')
wmod.simplefilter("always")
wmod.warn("foo")
self.assertEqual(str(w.message), "foo")
self.append(WarningMessage(*args, **kwargs))
def __getattr__(self, attr):
- return getattr(self[-1], attr)
+ """Return attributes from the last caught warning, or raise
+ AttributeError."""
+ try:
+ return getattr(self[-1], attr)
+ except IndexError:
+ raise AttributeError("no recorded warning to read "
+ "{0!r} attribute from".format(attr))
+
def reset(self):
del self[:]
Library
-------
+- Issue 3776: Deprecate the bsddb package for removal in 3.0.
+
- Issue #3762: platform.architecture() fails if python is lanched via
its symbolic link.