Commit 5472857b authored by Marius Gedminas's avatar Marius Gedminas

Fix ResourceWarning in fstail.py

parent 2d181876
...@@ -26,7 +26,7 @@ except ImportError: ...@@ -26,7 +26,7 @@ except ImportError:
from sha import sha as sha1 from sha import sha as sha1
def main(path, ntxn): def main(path, ntxn):
f = open(path, "rb") with open(path, "rb") as f:
f.seek(0, 2) f.seek(0, 2)
th = prev_txn(f) th = prev_txn(f)
i = ntxn i = ntxn
......
...@@ -11,7 +11,7 @@ We have to prepare a FileStorage first: ...@@ -11,7 +11,7 @@ We have to prepare a FileStorage first:
>>> from ZODB.DB import DB >>> from ZODB.DB import DB
>>> import transaction >>> import transaction
>>> from tempfile import mktemp >>> from tempfile import mktemp
>>> storagefile = mktemp() >>> storagefile = mktemp(suffix='.fs')
>>> base_storage = FileStorage(storagefile) >>> base_storage = FileStorage(storagefile)
>>> database = DB(base_storage) >>> database = DB(base_storage)
>>> connection1 = database.open() >>> connection1 = database.open()
...@@ -33,6 +33,7 @@ Now lets have a look at the last transactions of this FileStorage: ...@@ -33,6 +33,7 @@ Now lets have a look at the last transactions of this FileStorage:
Now clean up the storage again: Now clean up the storage again:
>>> import os >>> import os
>>> connection1.close()
>>> base_storage.close() >>> base_storage.close()
>>> os.unlink(storagefile) >>> os.unlink(storagefile)
>>> os.unlink(storagefile+'.index') >>> os.unlink(storagefile+'.index')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment