[Zodb-checkins] SVN: ZODB/trunk/src/ZODB/blob.py Added logic to
make sure open files don't get caught in exception
Jim Fulton
jim at zope.com
Sun Jun 10 17:24:21 EDT 2007
Log message for revision 76599:
Added logic to make sure open files don't get caught in exception
stack traces.
Changed:
U ZODB/trunk/src/ZODB/blob.py
-=-
Modified: ZODB/trunk/src/ZODB/blob.py
===================================================================
--- ZODB/trunk/src/ZODB/blob.py 2007-06-10 21:18:04 UTC (rev 76598)
+++ ZODB/trunk/src/ZODB/blob.py 2007-06-10 21:24:20 UTC (rev 76599)
@@ -623,7 +623,13 @@
os.rename(f1, f2)
except OSError:
copied("Copied blob file %r to %r.", f1, f2)
- utils.cp(open(f1, 'rb'), open(f2, 'wb'))
+ file1 = open(f1, 'rb')
+ file2 = open(f2, 'wb')
+ try:
+ utils.cp(file1, file2)
+ finally:
+ file1.close()
+ file2.close()
os.unlink(f1)
if chmod:
os.chmod(f2, stat.S_IREAD)
More information about the Zodb-checkins
mailing list