Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ed90570

Browse files
committed
forward-patch from release21-maint branch:
Make dumbdbm merely "dumb", rather than "terminally broken". Without this patch, it's almost impossible to use dumbdbm _without_ causing horrible datalossage. With this patch, dumbdbm passes my own horrible torture test, as well as the roundup test suite. dumbdbm really could do with a smidgin of a rewrite or two, but that's not suitable for the release21-maint branch.
1 parent bec5b36 commit ed90570

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

Lib/dumbdbm.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,15 @@ def __len__(self):
143143
return len(self._index)
144144

145145
def close(self):
146+
self._commit()
146147
self._index = None
147148
self._datfile = self._dirfile = self._bakfile = None
148149

150+
def __del__(self):
151+
if self._index is not None:
152+
self._commit()
153+
154+
149155

150156
def open(file, flag=None, mode=0666):
151157
# flag, mode arguments are currently ignored

0 commit comments

Comments
 (0)