Staging
v0.5.1
https://github.com/python/cpython
Revision ee139688d3d70ae8af00072cb8f0fb1d0d80a688 authored by Brian Curtin on 31 October 2010, 00:08:27 UTC, committed by Brian Curtin on 31 October 2010, 00:08:27 UTC
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r86003 | brian.curtin | 2010-10-30 19:03:45 -0500 (Sat, 30 Oct 2010) | 2 lines

  Fix ResourceWarning. Use context manager to properly close file.
........
1 parent f62ae82
Raw File
Tip revision: ee139688d3d70ae8af00072cb8f0fb1d0d80a688 authored by Brian Curtin on 31 October 2010, 00:08:27 UTC
Merged revisions 86003 via svnmerge from
Tip revision: ee13968
dbhash.py
"""Provide a (g)dbm-compatible interface to bsddb.hashopen."""

import sys
import warnings
warnings.warnpy3k("in 3.x, the dbhash module has been removed", stacklevel=2)
try:
    import bsddb
except ImportError:
    # prevent a second import of this module from spuriously succeeding
    del sys.modules[__name__]
    raise

__all__ = ["error","open"]

error = bsddb.error                     # Exported for anydbm

def open(file, flag = 'r', mode=0666):
    return bsddb.hashopen(file, flag, mode)
back to top