From: Alexandre Vassalotti Date: Fri, 12 Jun 2009 21:20:23 +0000 (+0000) Subject: Fix issue #6127: Make universal newlines mode of io.StringIO not X-Git-Tag: v2.6.3rc1~200 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dd0b90a367f4c04a0d2b210f59a29a2eb2200fec;p=python Fix issue #6127: Make universal newlines mode of io.StringIO not duplicate newlines under Windows (see also issue #5265 and #5645). --- diff --git a/Lib/io.py b/Lib/io.py index 320a4b9b5f..72f7d8c5ea 100644 --- 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)