From: <nr...@us...> - 2008-08-29 19:55:46
|
Revision: 5267 http://jython.svn.sourceforge.net/jython/?rev=5267&view=rev Author: nriley Date: 2008-08-29 19:55:43 +0000 (Fri, 29 Aug 2008) Log Message: ----------- Correct file position after truncate; similar to CPython's bug <http://bugs.python.org/issue801631>. Fixes test_file on Windows. Modified Paths: -------------- trunk/jython/src/org/python/core/io/FileIO.java Modified: trunk/jython/src/org/python/core/io/FileIO.java =================================================================== --- trunk/jython/src/org/python/core/io/FileIO.java 2008-08-29 19:53:04 UTC (rev 5266) +++ trunk/jython/src/org/python/core/io/FileIO.java 2008-08-29 19:55:43 UTC (rev 5267) @@ -313,7 +313,10 @@ checkClosed(); checkWritable(); try { + long oldPosition = fileChannel.position(); fileChannel.truncate(size); + // seek necessary on Windows only, see <http://bugs.python.org/issue801631> + fileChannel.position(oldPosition); } catch (IOException ioe) { throw Py.IOError(ioe); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |