annotate Lib/dbhash.py @ 58765:2ba7677bfa95 legacy-trunk

testCopysign was defined twice in test_math; combine the definitions
author Mark Dickinson <dickinsm@gmail.com>
date Sat, 06 Feb 2010 23:11:25 +0000
parents 751c6dd71b5e
children b62a682117e0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
28977
Skip Montanaro <skip@pobox.com>
parents: 18038
diff changeset
1 """Provide a (g)dbm-compatible interface to bsddb.hashopen."""
3357
1a17ba50bd68 backward compatible interface for bsddb
Guido van Rossum <guido@python.org>
parents:
diff changeset
2
16246
c41dd2204b9c fail more completely by deleting dbhash from sys.modules if bsddb can't be
Skip Montanaro <skip@pobox.com>
parents: 16070
diff changeset
3 import sys
49028
b45868fe489c Deprecate bsddb for removal in Python 3.0.
Brett Cannon <bcannon@gmail.com>
parents: 28977
diff changeset
4 if sys.py3kwarning:
b45868fe489c Deprecate bsddb for removal in Python 3.0.
Brett Cannon <bcannon@gmail.com>
parents: 28977
diff changeset
5 import warnings
63528
751c6dd71b5e Merged revisions 77310-77311 via svnmerge from
Ezio Melotti <ezio.melotti@gmail.com>
parents: 49028
diff changeset
6 warnings.warnpy3k("in 3.x, the dbhash module has been removed", DeprecationWarning, 2)
16246
c41dd2204b9c fail more completely by deleting dbhash from sys.modules if bsddb can't be
Skip Montanaro <skip@pobox.com>
parents: 16070
diff changeset
7 try:
c41dd2204b9c fail more completely by deleting dbhash from sys.modules if bsddb can't be
Skip Montanaro <skip@pobox.com>
parents: 16070
diff changeset
8 import bsddb
c41dd2204b9c fail more completely by deleting dbhash from sys.modules if bsddb can't be
Skip Montanaro <skip@pobox.com>
parents: 16070
diff changeset
9 except ImportError:
c41dd2204b9c fail more completely by deleting dbhash from sys.modules if bsddb can't be
Skip Montanaro <skip@pobox.com>
parents: 16070
diff changeset
10 # prevent a second import of this module from spuriously succeeding
c41dd2204b9c fail more completely by deleting dbhash from sys.modules if bsddb can't be
Skip Montanaro <skip@pobox.com>
parents: 16070
diff changeset
11 del sys.modules[__name__]
c41dd2204b9c fail more completely by deleting dbhash from sys.modules if bsddb can't be
Skip Montanaro <skip@pobox.com>
parents: 16070
diff changeset
12 raise
3357
1a17ba50bd68 backward compatible interface for bsddb
Guido van Rossum <guido@python.org>
parents:
diff changeset
13
16070
b5345e99596b added __all__ lists to a number of Python modules
Skip Montanaro <skip@pobox.com>
parents: 10821
diff changeset
14 __all__ = ["error","open"]
b5345e99596b added __all__ lists to a number of Python modules
Skip Montanaro <skip@pobox.com>
parents: 10821
diff changeset
15
10821
d3c6e9a126b2 Clarify why we define error. Suggested by Andrew Dalke.
Guido van Rossum <guido@python.org>
parents: 8624
diff changeset
16 error = bsddb.error # Exported for anydbm
3357
1a17ba50bd68 backward compatible interface for bsddb
Guido van Rossum <guido@python.org>
parents:
diff changeset
17
18038
a6f8b2fa2e20 Fix bug #422702: Make flag argument to open optional, and document it that way.
Martin v. Löwis <martin@v.loewis.de>
parents: 16246
diff changeset
18 def open(file, flag = 'r', mode=0666):
3357
1a17ba50bd68 backward compatible interface for bsddb
Guido van Rossum <guido@python.org>
parents:
diff changeset
19 return bsddb.hashopen(file, flag, mode)