[New-bugs-announce] [issue33106] Deleting a key in a read-only gdbm results in KeyError, not gdbm.error
sds
report at bugs.python.org
Mon Mar 19 17:44:11 EDT 2018
New submission from sds <sds at gnu.org>:
deleting a key from a read-only gdbm should be gdbm.error, not KeyError:
>>> import gdbm
>>> db = gdbm.open("foo","n") # create new
>>> db["a"] = "b"
>>> db.close()
>>> db = gdbm.open("foo","r") # read only
>>> db["x"] = "1"
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
gdbm.error: Reader can't store # correct
>>> db["a"]
'b'
>>> del db["a"]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
KeyError: 'a' # WRONG! should be the same as above
----------
components: Library (Lib)
messages: 314119
nosy: sam-s
priority: normal
severity: normal
status: open
title: Deleting a key in a read-only gdbm results in KeyError, not gdbm.error
type: behavior
versions: Python 2.7
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33106>
_______________________________________
More information about the New-bugs-announce
mailing list