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

Steve Dower report at bugs.python.org
Fri May 17 11:45:56 EDT 2019


Steve Dower <steve.dower at python.org> added the comment:

I think this should be opt-in, not opt-out.

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?

As a general rule, an embedded Python runtime should deal with all the settings it's been provided and not forcibly change *any* of them (though maybe the embedding application will discover bugs and have to update their entire application to deal with it - or switch to a language that isn't so demanding!).

For this specific case, it seems just as easy to opt-in by calling setlocale(LC_CTYPE, "") before initializing Python. We can recommend this in docs and do it ourselves in Py_Main, but I don't see why we'd add a specific option for configuring the user's C runtime.

----------

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


More information about the Python-bugs-list mailing list