[Python-Dev] New Python Initialization API (original) (raw)

Victor Stinner vstinner at redhat.com
Wed Mar 27 21:34:39 EDT 2019


Le mer. 27 mars 2019 à 19:35, Alexander Belopolsky <alexander.belopolsky at gmail.com> a écrit :

Would you consider making PyUnixMain public as well?

It is useful for high level embedding and not trivial for 3rd parties to reimplement.

Right, Py_Main() is causing a lot of practice issues, especially mojibake because of the C locale coercion (PEP 538) and UTF-8 Mode (PEP 540): both added in Python 3.7. I added that to the Rationale of my PEP 587.

I just fixed the mojibake issue in Python 3.8 by disabling C locale coercion and UTF-8 Mode by default. I'm not sure if nor how Python 3.7 should be fixed in a minor 3.7.x release.

Making _Py_UnixMain() public has already been discussed here: https://discuss.python.org/t/adding-char-based-apis-for-unix/916

My PEP 587 allows to pass command line arguments as bytes (char*) or Unicode (wchar_t*).

Ok, I just added Py_UnixMain() to the PEP (just make it part of the public API).

Victor

Night gathers, and now my watch begins. It shall not end until my death.



More information about the Python-Dev mailing list