Issue 1033: Support for newline and encoding in tempfile module (original) (raw)
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:
- tempfile.TemporaryFile, NamedTemporaryFile, and SpooledTemporaryFile now pass newline and encoding to the underlying io.open call.
- test_tempfile is updated
- test_csv is updated to use the new arguments.