Title: PyUnicode_AsEncodedString: the bootstrap hack is no more needed
Type: Stage:
Components: Interpreter Core, Unicode Versions: Python 3.3
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: vstinner
Priority: normal Keywords: patch

Created on 2011-02-11 13:04 by vstinner, last changed 2011-02-21 20:53 by vstinner. This issue is now closed.

File name Uploaded Description Edit
unicode_asencodedstring_bootstrap.patch vstinner, 2011-02-11 13:04
Messages (2)
msg128384 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2011-02-11 13:04
Since version 3.2, Python uses the locale encoding in PyUnicode_EncodeFSDefault() using _Py_wchar2char() and _Py_char2wchar() until the codec registry is initialized and the locale codec is loaded (until initfsencoding() is done).

Before Python 3.2, Python used ASCII in PyUnicode_AsEncodedString() at bootstrap  (before the codec registry was initialized): we don't need this hack anymore and it is bad to use ASCII instead of the locale encoding (encode/decode can fail).

This ticket is just a reminder for me: I am waiting Python 3.3 to remove PyUnicode_AsEncodedString() bootstrap hack ;-)
msg128993 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2011-02-21 20:53
Fixed by r88476. I prefer to only change it in Python 3.3, so no backport.
Date User Action Args
2011-02-21 20:53:17vstinnersetstatus: open -> closed

messages: + msg128993
resolution: fixed
2011-02-11 13:04:15vstinnersetcomponents: + Unicode
2011-02-11 13:04:08vstinnercreate