New submission from sds <[email protected]>:
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 <[email protected]>
<https://bugs.python.org/issue33106>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com