[Python-Dev] Issue #11022: locale.getpreferredencoding() must not set temporary LC_CTYPE (original) (raw)

Victor Stinner victor.stinner at gmail.com
Tue Jun 5 13:55:20 CEST 2012


Fine with me.

Ok, done with changeset 2587328c7c9c.

So in theory, your change should have no effect, unless somebody has modified some environment variables.

Changing TextIOWrapper to call locale.getpreferredlocale(False) instead of getpreferredlocale() has these two effects:

  1. without the patch, setting LC_ALL, LC_CTYPE or LANG environment variable changes the encoding used by TextIOWrapper.

  2. with the patch, setting LC_CTYPE (with locale.setlocale) changes the the encoding used by TextIOWrapper.

IMO (2) is less surprising than (1) For example, it is the expected behaviour of the reporter of the issue #11022.

In practice, it should not change anything for most people.

Victor



More information about the Python-Dev mailing list