Issue 6077: Unicode issue with tempfile on Windows (original) (raw)

Issue6077

Created on 2009-05-21 10:37 by daniel.ugra, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
UnicodeTest.py daniel.ugra,2009-05-21 10:37 Python source showing the wrong behavior
tempfile.patch amaury.forgeotdarc,2009-05-27 11:23
Messages (4)
msg88151 - (view) Author: Ugra Dániel (daniel.ugra) Date: 2009-05-21 10:37
Opening a file with tempfile.TemporaryFile using "wt+" mode, then reading content back, will cause reading to stop (without any exception) when encountering byte '0x1a' (aka. Ctrl+Z) on Windows even tough UTF-16 encoding is used. When using built-in open with the same parameters (plus a file name of course) everything works as expected. On Linux this issue does not exists.
msg88411 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2009-05-27 11:23
File descriptors wrapped by the new IO module should be opened in binary mode. The attached patch changes TemporaryFile and NamedTemporaryFile to always call os.open() in binary mode; the mode is really used by the io.open() function. mkstemp() returns a raw file descriptor and was not changed.
msg95552 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-11-20 15:13
The patch looks ok to me.
msg95827 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2009-11-30 00:17
Fixed with r76593 (py3k) and r76594 (release31-maint)
History
Date User Action Args
2022-04-11 14:56:49 admin set github: 50327
2009-11-30 00:17:01 amaury.forgeotdarc set status: open -> closedresolution: accepted -> fixedmessages: +
2009-11-20 15:13:52 pitrou set nosy: + pitroumessages: + assignee: amaury.forgeotdarcresolution: acceptedstage: patch review -> commit review
2009-11-20 12:33:18 pitrou set priority: normalversions: + Python 3.1, Python 3.2, - Python 3.0components: + IO, - Library (Lib)stage: patch review
2009-05-27 11:23:51 amaury.forgeotdarc set files: + tempfile.patchnosy: + amaury.forgeotdarcmessages: + keywords: + needs review, patch
2009-05-21 10:55:11 ezio.melotti set nosy: + ezio.melotti
2009-05-21 10:37:59 daniel.ugra create