Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 663809e

Browse files
author
Fredrik Lundh
committed
-- removed get_default compatibility kludge
-- added a few extra comments to locale.py
1 parent dde6164 commit 663809e

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

Lib/locale.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,9 +290,12 @@ def getdefaultlocale(envvars=('LANGUAGE', 'LC_ALL', 'LC_CTYPE', 'LANG')):
290290
except (ImportError, AttributeError):
291291
pass
292292
else:
293+
# make sure the code/encoding values are valid
293294
if sys.platform == "win32" and code and code[:2] == "0x":
294295
# map windows language identifier to language name
295296
code = windows_locale.get(int(code, 0))
297+
# ...add other platform-specific processing here, if
298+
# necessary...
296299
return code, encoding
297300

298301
# fall back on POSIX behaviour
@@ -306,8 +309,6 @@ def getdefaultlocale(envvars=('LANGUAGE', 'LC_ALL', 'LC_CTYPE', 'LANG')):
306309
localename = 'C'
307310
return _parse_localename(localename)
308311

309-
# compatibility
310-
get_default = getdefaultlocale
311312

312313
def getlocale(category=LC_CTYPE):
313314

Lib/site.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def addpackage(sitedir, name):
126126
#
127127
def locale_aware_defaultencoding():
128128
import locale
129-
code, encoding = locale.get_default()
129+
code, encoding = locale.getdefaultlocale()
130130
if encoding is None:
131131
encoding = 'ascii'
132132
try:

0 commit comments

Comments
 (0)