Mailing List Archive

[issue1033] Support for newline and encoding in tempfile module
New submission from Adam Hupp:

It would be useful for tempfile.TemporaryFile and friends to pass
newline and encoding arguments to the underlying io.open 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 io.open call.
2) test_tempfile is updated
3) test_csv is updated to use the new arguments.

----------
components: Library (Lib)
files: tempfile-newline-encoding.patch
messages: 55328
nosy: hupp
severity: normal
status: open
title: Support for newline and encoding in tempfile module
type: rfe
versions: Python 3.0

__________________________________
Tracker <report@bugs.python.org>
<http://bugs.python.org/issue1033>
__________________________________
[issue1033] Support for newline and encoding in tempfile module [ In reply to ]
New submission from Adam Hupp:

It would be useful for tempfile.TemporaryFile and friends to pass
newline and encoding arguments to the underlying io.open 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 io.open call.
2) test_tempfile is updated
3) test_csv is updated to use the new arguments.

----------
components: Library (Lib)
files: tempfile-newline-encoding.patch
messages: 55328
nosy: hupp
severity: normal
status: open
title: Support for newline and encoding in tempfile module
type: rfe
versions: Python 3.0

__________________________________
Tracker <report@bugs.python.org>
<http://bugs.python.org/issue1033>
__________________________________
[issue1033] Support for newline and encoding in tempfile module [ In reply to ]
Adam Hupp added the comment:

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.

__________________________________
Tracker <report@bugs.python.org>
<http://bugs.python.org/issue1033>
__________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue1033] Support for newline and encoding in tempfile module [ In reply to ]
Guido van Rossum added the comment:

Thanks!

Committed revision 57594.

General note: please run Tools/scripts/reindent.py over your files after
editing so I won't have to.

----------
nosy: +gvanrossum
resolution: -> accepted
status: open -> closed

__________________________________
Tracker <report@bugs.python.org>
<http://bugs.python.org/issue1033>
__________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com