[issue1395] py3k: duplicated line endings when using read(1)

Raghuram Devarakonda report at bugs.python.org
Thu Nov 8 19:54:25 CET 2007


Raghuram Devarakonda added the comment:

Considering that test_csv is failing on windows even without any changes
related to this issue, I looked at it and came up with this patch:

-----------------
Index: Lib/test/test_csv.py
===================================================================
--- Lib/test/test_csv.py        (revision 58914)
+++ Lib/test/test_csv.py        (working copy)
@@ -375,7 +375,7 @@
 
 class TestCsvBase(unittest.TestCase):
     def readerAssertEqual(self, input, expected_result):
-        with TemporaryFile("w+") as fileobj:
+        with TemporaryFile("w+", newline='') as fileobj:
             fileobj.write(input)
             fileobj.seek(0)
             reader = csv.reader(fileobj, dialect = self.dialect)
-----------------

Does this look ok? The tests pass on windows and Linux.

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1395>
__________________________________


More information about the Python-bugs-list mailing list