diff options
author | Tim Peters <tim.peters@gmail.com> | 2003-07-13 02:05:47 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2003-07-13 02:05:47 (GMT) |
commit | 1d8d729af80c7d45161f20a40428d26698c11af8 (patch) | |
tree | cdbe7aa19dc02120d8adcded31720b23de58bc32 /Lib/dumbdbm.py | |
parent | 4a6302b6fe1a0acb85267677a9be2ee925cf8248 (diff) | |
download | cpython-1d8d729af80c7d45161f20a40428d26698c11af8.zip cpython-1d8d729af80c7d45161f20a40428d26698c11af8.tar.gz cpython-1d8d729af80c7d45161f20a40428d26698c11af8.tar.bz2 |
More comments about why not closing a dumddbm properly can be a disaster.
Diffstat (limited to 'Lib/dumbdbm.py')
-rw-r--r-- | Lib/dumbdbm.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Lib/dumbdbm.py b/Lib/dumbdbm.py index db093d40..8e2ec90 100644 --- a/Lib/dumbdbm.py +++ b/Lib/dumbdbm.py @@ -128,8 +128,8 @@ class _Database(UserDict.DictMixin): return (pos, len(val)) # key is a new key whose associated value starts in the data file - # at offset pos and with length size. Add an index record to - # the in-memory index dict, and append one to the index file. + # at offset pos and with length siz. Add an index record to + # the in-memory index dict, and append one to the directory file. def _addkey(self, key, pos_and_siz_pair): self._index[key] = pos_and_siz_pair f = _open(self._dirfile, 'a', self._mode) @@ -157,7 +157,11 @@ class _Database(UserDict.DictMixin): # Note that _index may be out of synch with the directory # file now: _setval() and _addval() don't update the directory - # file. + # file. This also means that the on-disk directory and data + # files are in a mutually inconsistent state, and they'll + # remain that way until _commit() is called. Note that this + # is a disaster (for the database) if the program crashes + # (so that _commit() never gets called). def __delitem__(self, key): # The blocks used by the associated value are lost. |