Skip to content

Commit

Permalink
More ResourceWarnings fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mgedmin committed Feb 28, 2013
1 parent 290b073 commit bd50a59
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions src/ZODB/FileStorage/FileStorage.py
Original file line number Diff line number Diff line change
Expand Up @@ -962,10 +962,9 @@ def _txn_undo_write(self, tpos):
# We're undoing a blob modification operation.
# We have to copy the blob data
tmp = ZODB.utils.mktemp(dir=self.fshelper.temp_dir)
with open(tmp, 'wb') as fp:
ZODB.utils.cp(
self.openCommittedBlobFile(h.oid, userial),
fp)
with self.openCommittedBlobFile(h.oid, userial) as sfp:
with open(tmp, 'wb') as dfp:
ZODB.utils.cp(sfp, dfp)
self._blob_storeblob(h.oid, self._tid, tmp)

new = DataHeader(h.oid, self._tid, ipos, otloc, 0, len(p))
Expand Down
2 changes: 1 addition & 1 deletion src/ZODB/tests/IExternalGC.test
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ We can still get the data if we load before the time we deleted.
True
>>> storage.loadBefore(oid1, conn.root()._p_serial) == (p1, s1, tid)
True
>>> open(storage.loadBlob(oid1, s1)).read()
>>> with open(storage.loadBlob(oid1, s1)) as fp: fp.read()
'some data'

If we pack, however, the old data will be removed and the data will be
Expand Down

0 comments on commit bd50a59

Please sign in to comment.