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

2019-05-15 Thread Sebastian Koslowski
On Tue, May 14, 2019, 19:52 Steve Dower wrote: > It looks like Py_DecodeLocale() is available very early on - why > wouldn't we recommend using this function? It seems to be nearly a > drop-in replacement for mbtowcs in the samples, and if memory allocation > is a big deal perhaps we could just a

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

2019-05-14 Thread Steve Dower
On 10May2019 1832, Victor Stinner wrote: I studied code of applications embedding Python. Most of them has to decode bytes strings to get wchar_t* to set home, argv, program name, etc. I'm not sure that they use the "correct" encoding, especially since Python 3.7 got UTF-8 Mode (PEP 540) and C lo

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

2019-05-13 Thread Steve Dower
In response to all of your responses: No need to take offense, I was merely summarising the research you posted in a way that looks more like scenarios or requirements. It's a typical software engineering task. Being able to collect snippets and let people draw their own conclusions is one thi

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

2019-05-13 Thread Victor Stinner
)Le lun. 13 mai 2019 à 18:28, Steve Dower a écrit : > My take: > * all the examples are trying to be isolated from the system Python > install (except Vim?) "Isolation" means different things: * ignore configuration files * ignore environment variables * custom path configuration (sys.path, sys.

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

2019-05-13 Thread Steve Dower
On 10May2019 1832, Victor Stinner wrote: Hi, First of all, I just found an old issue that we will solved by my PEP 587 :-) Add Py_SetFatalErrorAbortFunc: Allow embedding program to handle fatal errors https://bugs.python.org/issue30560 Yes, this should be a feature of any redesigned embedding

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

2019-05-10 Thread Victor Stinner
Hi, First of all, I just found an old issue that we will solved by my PEP 587 :-) Add Py_SetFatalErrorAbortFunc: Allow embedding program to handle fatal errors https://bugs.python.org/issue30560 I studied code of applications embedding Python. Most of them has to decode bytes strings to get wcha

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

2019-05-04 Thread Victor Stinner
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 PyCo

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

2019-05-04 Thread Inada Naoki
2019年5月3日(金) 4:59 Victor Stinner : > > * 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 no

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

2019-05-02 Thread Victor Stinner
Le jeu. 2 mai 2019 à 16:20, Edwin Zimmerman a écrit : > > ``-c COMMAND````run_module = COMMAND`` > should read "run_command = COMMAND". Typo, not? Oops, you're right: it's a typo. Now fixed: ``-c COMMAND````run_command = COMMAND`` Victor -- Night gather

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

2019-05-02 Thread Edwin Zimmerman
On Thursday, May 02, 2019 Victor Stinner wrote: > According to this > * ``run_command`` (``wchar_t*``): ``-c COMMAND`` argument > * ``run_filename`` (``wchar_t*``): ``python3 SCRIPT`` argument > * ``run_module`` (``wchar_t*``): ``python3 -m MODULE`` argument this > ``-c COMMAND``

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

2019-05-02 Thread Victor Stinner
Hi, Thanks to Steve Dower's feedback, I enhanced and completed my PEP 587. Main changes: * It is now possible to read the configuration and then modify the read configuration. For example, new directories can be added to PyConfig.module_search_paths (see the example below and the example in the P