Issue #9548: Add a minimal "_bootlocale" module that is imported by the _io module instead of the full locale module.

This commit is contained in:
Antoine Pitrou 2013-10-12 00:13:50 +02:00
parent 73abc527eb
commit fd4722cacf
6 changed files with 49 additions and 22 deletions

View file

@ -426,8 +426,8 @@ def aliasmbcs():
while they are always available as "mbcs" in each locale. Make
them usable by aliasing to "mbcs" in such a case."""
if sys.platform == 'win32':
import locale, codecs
enc = locale.getdefaultlocale()[1]
import _bootlocale, codecs
enc = _bootlocale.getpreferredencoding(False)
if enc.startswith('cp'): # "cp***" ?
try:
codecs.lookup(enc)