diff options
author | Xiang Zhang <angwerzx@126.com> | 2018-12-12 12:46:55 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-12 12:46:55 (GMT) |
commit | 4fb0b8bc25c52aae8dcb4353e69c1c88999a9a53 (patch) | |
tree | aa3b18ad394fbd5056af5a366e2b4ca6b91d5296 /Lib/dbm/dumb.py | |
parent | 5a718e918db6211b633a7afb2bf537eb5b56cb1b (diff) | |
download | cpython-4fb0b8bc25c52aae8dcb4353e69c1c88999a9a53.zip cpython-4fb0b8bc25c52aae8dcb4353e69c1c88999a9a53.tar.gz cpython-4fb0b8bc25c52aae8dcb4353e69c1c88999a9a53.tar.bz2 |
bpo-33106: change dbm key deletion error for readonly file from KeyError to dbm.error (#6295)
Diffstat (limited to 'Lib/dbm/dumb.py')
-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 e5c17f5..6cef72a 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() |