From: <pj...@us...> - 2007-09-27 04:57:39
|
Revision: 3546 http://jython.svn.sourceforge.net/jython/?rev=3546&view=rev Author: pjenvey Date: 2007-09-26 21:57:24 -0700 (Wed, 26 Sep 2007) Log Message: ----------- ensure universal newlines' seek doesn't confuse CRLF newline identification Modified Paths: -------------- trunk/jython/Lib/test/test_file_newlines.py trunk/jython/src/org/python/core/PyFile.java Modified: trunk/jython/Lib/test/test_file_newlines.py =================================================================== --- trunk/jython/Lib/test/test_file_newlines.py 2007-09-25 23:14:25 UTC (rev 3545) +++ trunk/jython/Lib/test/test_file_newlines.py 2007-09-27 04:57:24 UTC (rev 3546) @@ -141,6 +141,14 @@ readline(self.fp, 'CRLF\n', 5) readline(self.fp, 'EOF', 3) + def test_seek(self): + # Ensure seek doesn't confuse CRLF newline identification + self.fp.seek(6) + readline(self.fp, 'CRLF\n') + assert self.fp.newlines == None + self.fp.seek(5) + readline(self.fp, '\n') + assert self.fp.newlines == '\n' class WriteUniversalNewlinesTestCase(unittest.TestCase): Modified: trunk/jython/src/org/python/core/PyFile.java =================================================================== --- trunk/jython/src/org/python/core/PyFile.java 2007-09-25 23:14:25 UTC (rev 3545) +++ trunk/jython/src/org/python/core/PyFile.java 2007-09-27 04:57:24 UTC (rev 3546) @@ -1702,6 +1702,7 @@ public void seek(long pos, int how) throws IOException { file.seek(pos, how); + skipNextLF = false; } public void flush() throws IOException { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |