This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: correction for test_tempfile in py3k on Windows
Type: Stage:
Components: Windows Versions: Python 3.0
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: gvanrossum Nosy List: amaury.forgeotdarc, christian.heimes, gvanrossum
Priority: normal Keywords:

Created on 2007-10-26 23:28 by amaury.forgeotdarc, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (6)
msg56830 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2007-10-26 23:28
This tiny patch correct a failure in test_tempfile on Windows: in
SpooledTemporaryFile, avoid translating the newlines twice.
Otherwise, in "universal" text mode, \n gets transformed to \r\n, then
to \r\r\n, which is read as \n\n.
Passing the encoding is OK, since the round-trip gives the same result,
and it allow encoding errors to occur at the right place.

Index: Lib/tempfile.py
===================================================================
--- Lib/tempfile.py     (revision 58680)
+++ Lib/tempfile.py     (working copy)
@@ -495,7 +495,7 @@
         if 'b' in mode:
             self._file = _io.BytesIO()
         else:
-            self._file = _io.StringIO(encoding=encoding, newline=newline)
+            self._file = _io.StringIO(encoding=encoding)
         self._max_size = max_size
         self._rolled = False
         self._TemporaryFileArgs = {'mode': mode, 'buffering': buffering,
msg56861 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2007-10-27 21:02
The patch is fine but you should add a short comment to avoid future
trouble. On the first glance it's not obvious why the StringIO instance
mustn't have a newline argument.
msg56881 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2007-10-28 15:12
Committed revision 58699.  (My own interpretation of the patch, with
comment :-)

I expect this will fix a bunch Windows failures; I've seen complaints
inmplicating doubled newlines in a few places, and this mught just be
the cause.  Thanks!
msg56883 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2007-10-28 15:33
D'oh, I submitted to the wrong branch.  The py3k branch will have to
wait until after my son's birthday party. ;-)
msg56884 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2007-10-28 15:53
Guido van Rossum wrote:
> Guido van Rossum added the comment:
> 
> D'oh, I submitted to the wrong branch.  The py3k branch will have to
> wait until after my son's birthday party. ;-)

Have a nice party! How old is he? IIRC he was about 4 on the pictures
you showed us at EuroPython 2005 in Göteborg.
msg56911 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2007-10-29 17:16
New Revision: 58701.
History
Date User Action Args
2022-04-11 14:56:27adminsetgithub: 45681
2007-10-29 17:16:42gvanrossumsetstatus: open -> closed
messages: + msg56911
2007-10-28 15:53:54christian.heimessetmessages: + msg56884
2007-10-28 15:33:22gvanrossumsetstatus: closed -> open
messages: + msg56883
2007-10-28 15:12:51gvanrossumsetstatus: open -> closed
resolution: accepted
messages: + msg56881
2007-10-28 14:59:14gvanrossumsetassignee: gvanrossum
2007-10-27 21:02:32christian.heimessetnosy: + christian.heimes, gvanrossum
messages: + msg56861
2007-10-26 23:28:09amaury.forgeotdarccreate