]> granicus.if.org Git - python/commitdiff
In rseponse to bug# 1029, force the newline default for StringIO to "\n",
authorGuido van Rossum <guido@python.org>
Wed, 29 Aug 2007 18:31:16 +0000 (18:31 +0000)
committerGuido van Rossum <guido@python.org>
Wed, 29 Aug 2007 18:31:16 +0000 (18:31 +0000)
so that even on Windows, after s.write("x\n"), s.getvalue() == "x\n".

Lib/io.py

index 375ae6e2c89de3c6a7241d8bfe4ea34422be1c78..710027852b5921d3835d10353d3aae4b1901dfb3 100644 (file)
--- a/Lib/io.py
+++ b/Lib/io.py
@@ -1390,7 +1390,7 @@ class StringIO(TextIOWrapper):
 
     # XXX This is really slow, but fully functional
 
-    def __init__(self, initial_value="", encoding="utf-8", newline=None):
+    def __init__(self, initial_value="", encoding="utf-8", newline="\n"):
         super(StringIO, self).__init__(BytesIO(),
                                        encoding=encoding,
                                        newline=newline)