Title: Support for newline and encoding in tempfile module
Type: enhancement Stage:
Components: Library (Lib) Versions: Python 3.0
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: Nosy List: gvanrossum, hupp
Priority: normal Keywords:

Created on 2007-08-27 00:10 by hupp, last changed 2007-08-28 03:30 by gvanrossum. This issue is now closed.

File name Uploaded Description Edit
tempfile-newline-encoding.patch hupp, 2007-08-27 00:10
Messages (3)
msg55328 - (view) Author: Adam Hupp (hupp) Date: 2007-08-27 00:10
It would be useful for tempfile.TemporaryFile and friends to pass
newline and encoding arguments to the underlying call.  For
example, several tests in test_csv use TemporaryFile and need to handle
unicode file output or preserve exact newlines.  This is simpler with
direct support in TemporaryFile.

The attached patch makes the following changes:

 1) tempfile.TemporaryFile, NamedTemporaryFile, and SpooledTemporaryFile
 now pass newline and encoding to the underlying call.
 2) test_tempfile is updated
 3) test_csv is updated to use the new arguments.
msg55329 - (view) Author: Adam Hupp (hupp) Date: 2007-08-27 00:14
One change I forgot to mention that may need discussion.  I've changed
the 'bufsize' arguments in tempfile to 'buffering', since that is
consistent with the same change in os.fdopen.
msg55349 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2007-08-28 03:30

Committed revision 57594.

General note: please run Tools/scripts/ over your files after
editing so I won't have to.
Date User Action Args
2007-08-28 03:30:24gvanrossumsetstatus: open -> closed
resolution: accepted
messages: + msg55349
nosy: + gvanrossum
2007-08-27 00:14:05huppsetmessages: + msg55329
2007-08-27 00:10:44huppcreate