bpo-29240: PEP 540: Add a new UTF-8 mode by vstinner · Pull Request #855 · python/cpython (original) (raw)
I feel adding more code to Program/python.c is bad smell.
It is.
Py_Main() is very high level API, but very hard to use in right way for Unix users. How about adding Py_UnixMain() and move all code in main() to it?
main() and Py_Main() are very complex. With the PEP 432, Nick Coghlan, Eric Snow and me are working on making this code better. See for example https://bugs.python.org/issue32030
Currently, Py_Main() (Modules/main.c) and _PyPathConfig_Calculate() (Modules/getpath.c and PC/getpathp.c) are fully implemented with wchar_t*.
Parsing the command line options using char* on Unix but wchar_t* would make the code more complex. I expect that many lines of code would have to be duplicate, one version for char*, one version for wchar_t*.
For all these reasons, I propose to merge this uncomplete PR and write a different PR for the most complex part, re-encode wchar_t* command line arguments, implement Py_UnixMain() or another even better option?