diff options
author | Berker Peksag <berker.peksag@gmail.com> | 2017-02-04 09:19:04 +0300 |
---|---|---|
committer | Berker Peksag <berker.peksag@gmail.com> | 2017-02-04 09:19:04 +0300 |
commit | b53991455f7f258ede7a26b69c2be5b8138b9f8a (patch) | |
tree | 3615cf0ef453ab113a547b1dfebacf415ed32602 /Lib/dbm/dumb.py | |
parent | 678487eb345f9f9dea3d3818ecad7d39145bdc65 (diff) | |
parent | 9bfb9694a65124a8191cdb8ce7992445d1d0f4d2 (diff) | |
download | cpython-b53991455f7f258ede7a26b69c2be5b8138b9f8a.tar.gz |
Issue #29198: Merge from 3.6
Diffstat (limited to 'Lib/dbm/dumb.py')
-rw-r--r-- | Lib/dbm/dumb.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Lib/dbm/dumb.py b/Lib/dbm/dumb.py index 2296dbfd54..c3c4a66601 100644 --- a/Lib/dbm/dumb.py +++ b/Lib/dbm/dumb.py @@ -68,7 +68,7 @@ class _Database(collections.MutableMapping): # Handle the creation self._create(flag) - self._update() + self._update(flag) def _create(self, flag): if flag == 'n': @@ -92,12 +92,17 @@ class _Database(collections.MutableMapping): f.close() # Read directory file into the in-memory index dict. - def _update(self): + def _update(self, flag): self._index = {} try: f = _io.open(self._dirfile, 'r', encoding="Latin-1") except OSError: self._modified = not self._readonly + if flag not in ('c', 'n'): + import warnings + warnings.warn("The index file is missing, the " + "semantics of the 'c' flag will be used.", + DeprecationWarning, stacklevel=4) else: self._modified = False with f: |