mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
#3929: dbm.open() would try to raise a tuple. This does not work anymore with python 3.0.
Reviewed by Georg Brandl.
This commit is contained in:
parent
7de5f29972
commit
b5cf301b8e
3 changed files with 11 additions and 4 deletions
|
@ -76,12 +76,12 @@ def open(file, flag = 'r', mode = 0o666):
|
||||||
# file doesn't exist and the new flag was used so use default type
|
# file doesn't exist and the new flag was used so use default type
|
||||||
mod = _defaultmod
|
mod = _defaultmod
|
||||||
else:
|
else:
|
||||||
raise error("need 'c' or 'n' flag to open new db")
|
raise error[0]("need 'c' or 'n' flag to open new db")
|
||||||
elif result == "":
|
elif result == "":
|
||||||
# db type cannot be determined
|
# db type cannot be determined
|
||||||
raise error("db type could not be determined")
|
raise error[0]("db type could not be determined")
|
||||||
elif result not in _modules:
|
elif result not in _modules:
|
||||||
raise error("db type is {0}, but the module is not "
|
raise error[0]("db type is {0}, but the module is not "
|
||||||
"available".format(result))
|
"available".format(result))
|
||||||
else:
|
else:
|
||||||
mod = _modules[result]
|
mod = _modules[result]
|
||||||
|
|
|
@ -57,6 +57,9 @@ class AnyDBMTestCase(unittest.TestCase):
|
||||||
def test_error(self):
|
def test_error(self):
|
||||||
self.assert_(issubclass(self.module.error, IOError))
|
self.assert_(issubclass(self.module.error, IOError))
|
||||||
|
|
||||||
|
def test_anydbm_not_existing(self):
|
||||||
|
self.assertRaises(dbm.error, dbm.open, _fname)
|
||||||
|
|
||||||
def test_anydbm_creation(self):
|
def test_anydbm_creation(self):
|
||||||
f = dbm.open(_fname, 'c')
|
f = dbm.open(_fname, 'c')
|
||||||
self.assertEqual(list(f.keys()), [])
|
self.assertEqual(list(f.keys()), [])
|
||||||
|
|
|
@ -20,6 +20,10 @@ Core and Builtins
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #3929: When the database cannot be opened, dbm.open() would incorrectly
|
||||||
|
raise a TypeError: "'tuple' object is not callable" instead of the expected
|
||||||
|
dbm.error.
|
||||||
|
|
||||||
- Bug #3884: Make the turtle module toplevel again.
|
- Bug #3884: Make the turtle module toplevel again.
|
||||||
|
|
||||||
- Issue #3547: Fixed ctypes structures bitfields of varying integer
|
- Issue #3547: Fixed ctypes structures bitfields of varying integer
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue