[Python-Dev] RFC: PEP 587 "Python Initialization Configuration": 2nd version
vstinner at redhat.com
Sat May 4 11:45:49 EDT 2019
This PEP is the result of 2 years of refactoring to *simplify* the
*implementation*. I agree that bytes string is the native type on Unix.
But. On Windows, Unicode is the native type. On Python 3, Unicode is the
native type. One key of the simplified implementation is the unique
PyConfig structure. It means that all platforms have to use the same types.
I love the idea of using only wchar_t* for PyConfig because it makes Python
initialization more reliable. The question of the encoding used to decode
byte strings and any possible decoding error (very unlikely thanks to
surrogateescape) is better defined: it occurs when you set the parameter,
not "later during init".
The PEP adds Py_UnixMain() for most trivial use cases, and
PyConfig_DecodeLocale() and PyConfig_SetArgs() for more advanced cases.
Le samedi 4 mai 2019, Inada Naoki <songofacandy at gmail.com> a écrit :
> 2019年5月3日(金) 4:59 Victor Stinner <vstinner at redhat.com>:
>> * PyConfig now only uses wchar_t* for strings (unicode): char* (bytes)
>> is no longer used. I had to hack CPython internals for that :-)
> I prefer char* to wchar_t* on Unix. Since UTF-8 dominated Unix world
> in these decades, wchar_t* is less usable on Unix nowadays.
> Is it impossible to use just char* on Unix and wchar_t* on Windows?
> Inada Naoki <songofacandy at gmail.com>
Night gathers, and now my watch begins. It shall not end until my death.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-Dev