homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients vstinner
Date 2010年05月04日.13:30:47
SpamBayes Score 1.8510756e-08
Marked as misclassified No
Message-id <1272979850.31.0.0455265952928.issue8611@psf.upfronthosting.co.za>
In-reply-to
Content
Python3 is unable to start (bootstrap failure) on a POSIX system if the locale encoding is different than utf8 and the Python path (standard library path where the encoding module is stored) contains a non-ASCII character. (Windows and Mac OS X are not affected by this issue because the file system encoding is hardcoded.)
 - Py_FileSystemDefaultEncoding == NULL
 - calculate_path(): sys.path is filled with directory names decoded with the locale encoding
 - find_module() encodes each path using PyUnicode_AsEncodedString(..., Py_FileSystemDefaultEncoding, NULL): use "utf-8" encoding because Py_FileSystemDefaultEncoding is NULL
=> error because the path is not encoded and decoded with the same encoding
We cannot encodes a path with the locale encoding because we need find_module() to load the encoding codec, and loading the codec needs find_module()... (bootstrap error :-))
We should decodes the path using a fixed encoding (eg. ASCII or utf-8), use the same encoding to encodes paths in find_module(), and then reencode paths of all objects storing filenames:
 - sys.path list items
 - sys.modules dict keys
 - sys.modules values: each module have __file__ and/or __path__ attributes
 - all code objects (co_filename)
 - (maybe some other?)
The error occurs in an early stage of Py_InitializeEx(), so the object list is limited and we control this list (eg. site is not loaded yet).
Related issues:
 - #8610: "Python3/POSIX: errors if file system encoding is None"
 - #8242: "Improve support of PEP 383 (surrogates) in Python3: meta-issue"
History
Date User Action Args
2010年05月04日 13:30:50vstinnersetrecipients: + vstinner
2010年05月04日 13:30:50vstinnersetmessageid: <1272979850.31.0.0455265952928.issue8611@psf.upfronthosting.co.za>
2010年05月04日 13:30:49vstinnerlinkissue8611 messages
2010年05月04日 13:30:48vstinnercreate

AltStyle によって変換されたページ (->オリジナル) /