[issue36945] Add _PyPreConfig.configure_locale: allow to leave LC_CTYPE unchanged when embedding Python

STINNER Victor report at bugs.python.org
Fri May 17 12:48:49 EDT 2019


STINNER Victor <vstinner at redhat.com> added the comment:

Steve:
> Imagine you're an existing application and you want to embed Python. Why would you ever want it to suddenly change your global settings like this?

I have a very good news for you :-) Slowly but steadily, we converge on a agreement ;-)

The more time I spend on PEP 587, the more I think that the following use cases are too different and "incompatible":

* customized Python interpreter: behaves as the "regular Python"
* Embedded Python

I drafted "Isolate Python" in my PEP 587. With subtle options like configure_c_stdio, parse_argv and now configure_locale, it seems like we really need two *separated* these two configurations.

I implemented exactly that in PR 13388, I added 2 functions:

* _PyCoreConfig_InitPythonConfig(): provide a default configuration which parses command line arguments, enable UTF-8 Mode depending on the locale, read global configuration variables, read environment variables, etc.

* _PyCoreConfig_InitIsolateConfig(): isolated from the system, ignore command line arguments, ignore global configuration variables, leave the LC_CTYPE locale and C streams unchanged, etc.

I'm working on an update of my PEP to better describe that.

--

So I understand that this option is needed and you should prefer to turn it off by default in _PyCoreConfig_InitIsolateConfig.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36945>
_______________________________________


More information about the Python-bugs-list mailing list