cpython: e91e9b9ba180 (original) (raw)

Mercurial > cpython

changeset 84485:e91e9b9ba180

#17198: merge with 3.3. [#17198]

Ezio Melotti ezio.melotti@gmail.com
date Sun, 07 Jul 2013 13:16:05 +0200
parents 2ab2a2bfea49(current diff)65fce1dad331(diff)
children a5010de76eda
files Lib/dbm/__init__.py Lib/test/test_dbm.py Misc/NEWS
diffstat 3 files changed, 24 insertions(+), 2 deletions(-)[+] [-] Lib/dbm/__init__.py 5 Lib/test/test_dbm.py 18 Misc/NEWS 3

line wrap: on

line diff

--- a/Lib/dbm/init.py +++ b/Lib/dbm/init.py @@ -44,6 +44,11 @@ class error(Exception): error = (error, OSError) +try:

+except ImportError:

+ def open(file, flag='r', mode=0o666): """Open or create database at path given by file.

--- a/Lib/test/test_dbm.py +++ b/Lib/test/test_dbm.py @@ -9,6 +9,11 @@ import test.support

Skip tests if dbm module doesn't exist.

dbm = test.support.import_module('dbm') +try:

+except ImportError:

+ _fname = test.support.TESTFN # @@ -130,7 +135,7 @@ class WhichDBTestCase(unittest.TestCase) delete_files() f = module.open(_fname, 'c') f.close()

@@ -139,7 +144,15 @@ class WhichDBTestCase(unittest.TestCase) # and read it self.assertTrue(f[b"1"] == b"1") f.close()

+

def tearDown(self): delete_files() @@ -149,6 +162,7 @@ class WhichDBTestCase(unittest.TestCase) self.filename = test.support.TESTFN self.d = dbm.open(self.filename, 'c') self.d.close()

def test_keys(self): self.d = dbm.open(self.filename, 'c')

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -142,6 +142,9 @@ Core and Builtins Library ------- +- Issue #17198: Fix a NameError in the dbm module. Patch by Valentina