]> granicus.if.org Git - python/commitdiff
Fix issue #6127: Make universal newlines mode of io.StringIO not
authorAlexandre Vassalotti <alexandre@peadrop.com>
Fri, 12 Jun 2009 21:20:23 +0000 (21:20 +0000)
committerAlexandre Vassalotti <alexandre@peadrop.com>
Fri, 12 Jun 2009 21:20:23 +0000 (21:20 +0000)
duplicate newlines under Windows (see also issue #5265 and #5645).

Lib/io.py

index 320a4b9b5f23fc79da2b93e7d04d5898ddf85faa..72f7d8c5eadb9d7fa7b781988e503863fce260b2 100644 (file)
--- a/Lib/io.py
+++ b/Lib/io.py
@@ -1852,6 +1852,10 @@ class StringIO(TextIOWrapper):
                                        encoding=encoding,
                                        errors=errors,
                                        newline=newline)
+        # Issue #5645: make universal newlines semantics the same as in the
+        # C version, even under Windows.
+        if newline is None:
+            self._writetranslate = False
         if initial_value:
             if not isinstance(initial_value, unicode):
                 initial_value = unicode(initial_value)