##// END OF EJS Templates
compat: back out a25343d16ebe (initialize LC_CTYPE locale on all Python ...)...
Manuel Jacob -
r45557:f2dc3371 default
parent child Browse files
Show More
@@ -13,7 +13,6 b' from __future__ import absolute_import'
13 import getopt
13 import getopt
14 import inspect
14 import inspect
15 import json
15 import json
16 import locale
17 import os
16 import os
18 import shlex
17 import shlex
19 import sys
18 import sys
@@ -94,26 +93,6 b' def rapply(f, xs):'
94 return _rapply(f, xs)
93 return _rapply(f, xs)
95
94
96
95
97 # Passing the '' locale means that the locale should be set according to the
98 # user settings (environment variables).
99 # Python sometimes avoids setting the global locale settings. When interfacing
100 # with C code (e.g. the curses module or the Subversion bindings), the global
101 # locale settings must be initialized correctly. Python 2 does not initialize
102 # the global locale settings on interpreter startup. Python 3 sometimes
103 # initializes LC_CTYPE, but not consistently at least on Windows. Therefore we
104 # explicitly initialize it to get consistent behavior if it's not already
105 # initialized. Since CPython commit 177d921c8c03d30daa32994362023f777624b10d,
106 # LC_CTYPE is always initialized. If we require Python 3.8+, we should re-check
107 # if we can remove this code.
108 if locale.setlocale(locale.LC_CTYPE, None) == 'C':
109 try:
110 locale.setlocale(locale.LC_CTYPE, '')
111 except locale.Error:
112 # The likely case is that the locale from the environment variables is
113 # unknown.
114 pass
115
116
117 if ispy3:
96 if ispy3:
118 import builtins
97 import builtins
119 import codecs
98 import codecs
General Comments 0
You need to be logged in to leave comments. Login now