mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
Issue 1340 by Amaury Forgeot d'Arc (with help from Christian Heimes,
and my own interpretation). Don't pass the newline= flag to StringIO in SpooledTemporaryFile. This avoids doubling newlines when the file is rolled over.
This commit is contained in:
parent
1b16ca4ef1
commit
5d21255968
1 changed files with 4 additions and 1 deletions
|
@ -495,7 +495,10 @@ class SpooledTemporaryFile:
|
|||
if 'b' in mode:
|
||||
self._file = _io.BytesIO()
|
||||
else:
|
||||
self._file = _io.StringIO(encoding=encoding, newline=newline)
|
||||
# Setting newline="\n" avoids newline translation;
|
||||
# this is important because otherwise on Windows we'd
|
||||
# hget double newline translation upon rollover().
|
||||
self._file = _io.StringIO(encoding=encoding, newline="\n")
|
||||
self._max_size = max_size
|
||||
self._rolled = False
|
||||
self._TemporaryFileArgs = {'mode': mode, 'buffering': buffering,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue