diff options
author | 2018-12-12 20:46:55 +0800 | |
---|---|---|
committer | 2018-12-12 20:46:55 +0800 | |
commit | 4fb0b8bc25c52aae8dcb4353e69c1c88999a9a53 (patch) | |
tree | aa3b18ad394fbd5056af5a366e2b4ca6b91d5296 /Lib/dbm | |
parent | Add test for double patching instance methods (#11085) (diff) | |
download | cpython-4fb0b8bc25c52aae8dcb4353e69c1c88999a9a53.tar.gz cpython-4fb0b8bc25c52aae8dcb4353e69c1c88999a9a53.tar.bz2 cpython-4fb0b8bc25c52aae8dcb4353e69c1c88999a9a53.zip |
bpo-33106: change dbm key deletion error for readonly file from KeyError to dbm.error (#6295)
Diffstat (limited to 'Lib/dbm')
-rw-r--r-- | Lib/dbm/dumb.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/dbm/dumb.py b/Lib/dbm/dumb.py index e5c17f5ae2e..6cef72a49ac 100644 --- a/Lib/dbm/dumb.py +++ b/Lib/dbm/dumb.py @@ -185,7 +185,7 @@ class _Database(collections.abc.MutableMapping): def __setitem__(self, key, val): if self._readonly: - raise ValueError('The database is opened for reading only') + raise error('The database is opened for reading only') if isinstance(key, str): key = key.encode('utf-8') elif not isinstance(key, (bytes, bytearray)): @@ -222,7 +222,7 @@ class _Database(collections.abc.MutableMapping): def __delitem__(self, key): if self._readonly: - raise ValueError('The database is opened for reading only') + raise error('The database is opened for reading only') if isinstance(key, str): key = key.encode('utf-8') self._verify_open() |