[issue41941] Py_Initialize affects the console

Eryk Sun report at bugs.python.org
Mon Oct 5 09:07:39 EDT 2020


Eryk Sun <eryksun at gmail.com> added the comment:

Having looked at the screenshots, it seems that your issue is in part due to non-legacy mode not setting the standard I/O files to binary mode (_O_BINARY) from their default ANSI text mode (_O_TEXT). This is not a problem on its own. 

The real issue is that you're not using an isolated configuration, as Victor suggested, so the LC_CTYPE locale gets set to the default user locale instead of "C". When writing to the console in ANSI text mode with a configured locale other than the default "C" locale, the C runtime _write() function does a double translation from the locale encoding to the console codepage encoding via the internal function write_double_translated_ansi_nolock().

----------

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


More information about the Python-bugs-list mailing list