This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients eryksun, paul.moore, steve.dower, tim.golden, vstinner, zach.ware
Date 2020-11-04.15:42:24
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1604504544.15.0.112310587465.issue42261@roundup.psfhosted.org>
In-reply-to
Content
> This is based on config_init_stdio_encoding() in Python/initconfig.c, which sets config->stdio_encoding via config_get_locale_encoding(). Cannot config->stdio_encoding be set to NULL for default behavior?

I would like to get a PyConfig structure fully populated to make the Python initialization more deterministic and reliable. So PyConfig fully control used encodings.

The solution here is to fix config_init_stdio_encoding() to use GetConsoleCP() and GetConsoleOutputCP() to build a "cpXXX" string.

This issue seems to be a regression that I introduced in Python 3.8 with the PEP 587 (PyConfig). I didn't notice this subtle case during my refactoring. Relying on os.device_encoding() when the encoding is NULL is not obvious. That's why I prefer to get PyConfig full populated ;-)

It would be nice to get an unit test for this case.
History
Date User Action Args
2020-11-04 15:42:24vstinnersetrecipients: + vstinner, paul.moore, tim.golden, zach.ware, eryksun, steve.dower
2020-11-04 15:42:24vstinnersetmessageid: <1604504544.15.0.112310587465.issue42261@roundup.psfhosted.org>
2020-11-04 15:42:24vstinnerlinkissue42261 messages
2020-11-04 15:42:24vstinnercreate