Alexandre Vassalotti added the comment:

> That's why the current behaviour is not correct: When I write('\n'),
> getvalue() currently returns '\r\n'.

Oh, I missed your example in your initial message. So yes, I agree that
StringIO shouldn't translate newlines like that. I attached a patch that
should fix the bug.

However, I would favor removing the "newline" keyword argument, instead.

__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1029>
__________________________________
Index: Lib/io.py
===================================================================
--- Lib/io.py	(revision 57506)
+++ Lib/io.py	(working copy)
@@ -1367,6 +1367,7 @@
                 initial_value = str(initial_value)
             self.write(initial_value)
             self.seek(0)
+        self._writetranslate = False
 
     def getvalue(self):
         self.flush()
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to