osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Python-Dev] RFC: PEP 587 "Python Initialization Configuration": 2nd version


Hi INADA-san,

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.

Victor

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...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20190504/f9a22929/attachment-0001.html>