[issue28847] dumbdbm should not commit if in read mode
Jonathan Ng
report at bugs.python.org
Thu Dec 1 07:23:05 EST 2016
Jonathan Ng added the comment:
I'm not sure how to create an OSError.
But perhaps something like this:
'''
from dbm import dumb
import os
db = dumb.open('temp', flag='n')
db['foo'] = 'bar'
db.close()
db = dumb.open('temp', flag='r')
print(len(db.keys()))
db.close
os.rename('temp.dir', 'temp_.dir') # simulates OSError
db = dumb.open('temp', flag='r')
os.rename('temp_.dir', 'temp.dir')
db.close()
db = dumb.open('temp', flag='r')
assert len(db.keys()) > 0
'''
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28847>
_______________________________________
More information about the Python-bugs-list
mailing list