From: <nr...@us...> - 2008-08-29 19:53:07
|
Revision: 5266 http://jython.svn.sourceforge.net/jython/?rev=5266&view=rev Author: nriley Date: 2008-08-29 19:53:04 +0000 (Fri, 29 Aug 2008) Log Message: ----------- Close file immediately after comparing it. Fixes test_filecmp on Windows. Modified Paths: -------------- trunk/jython/CPythonLib.includes trunk/jython/Lib/filecmp.py Modified: trunk/jython/CPythonLib.includes =================================================================== --- trunk/jython/CPythonLib.includes 2008-08-29 19:51:57 UTC (rev 5265) +++ trunk/jython/CPythonLib.includes 2008-08-29 19:53:04 UTC (rev 5266) @@ -52,7 +52,6 @@ dospath.py dumbdbm.py exceptions.py -filecmp.py fileinput.py fnmatch.py formatter.py Modified: trunk/jython/Lib/filecmp.py =================================================================== --- trunk/jython/Lib/filecmp.py 2008-08-29 19:51:57 UTC (rev 5265) +++ trunk/jython/Lib/filecmp.py 2008-08-29 19:53:04 UTC (rev 5266) @@ -65,13 +65,17 @@ bufsize = BUFSIZE fp1 = open(f1, 'rb') fp2 = open(f2, 'rb') - while True: - b1 = fp1.read(bufsize) - b2 = fp2.read(bufsize) - if b1 != b2: - return False - if not b1: - return True + try: + while True: + b1 = fp1.read(bufsize) + b2 = fp2.read(bufsize) + if b1 != b2: + return False + if not b1: + return True + finally: + fp1.close() + fp2.close() # Directory comparison class. # This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |