[New-bugs-announce] [issue3929] Incorrect exception raising in dbm.open on non-existing DB

Hagen Fürstenau report at bugs.python.org
Mon Sep 22 12:07:59 CEST 2008


New submission from Hagen Fürstenau <hfuerstenau at gmx.net>:

Opening a dbm database which doesn't exist without a "c" or "n" flag
results in this exception:

>>> import dbm
>>> dbm.open("abc")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/MP.shadow/hagenf/local/src/py3k/Lib/dbm/__init__.py", line
79, in open
    raise error("need 'c' or 'n' flag to open new db")
TypeError: 'tuple' object is not callable

"error" is a tuple of dbm's own exception class and IOError, but this
doesn't seem to make sense in the present code and Python 3.0. The
attached patch fixes the problem and adds a test for the correct
exception being raised.

----------
components: Library (Lib)
files: dbm.patch
keywords: patch
messages: 73563
nosy: hagen
severity: normal
status: open
title: Incorrect exception raising in dbm.open on non-existing DB
type: behavior
versions: Python 3.0
Added file: http://bugs.python.org/file11555/dbm.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3929>
_______________________________________


More information about the New-bugs-announce mailing list