mirror of
https://github.com/python/cpython.git
synced 2026-05-30 22:30:44 +00:00
gh-123853: Cleanup Windows 95 locale fallback support (#144738)
Closes #123853
This commit is contained in:
parent
6ea84b2726
commit
171e0facc4
3 changed files with 1 additions and 15 deletions
|
|
@ -570,10 +570,6 @@ def _getdefaultlocale(envvars=('LC_ALL', 'LC_CTYPE', 'LANG', 'LANGUAGE')):
|
|||
except (ImportError, AttributeError):
|
||||
pass
|
||||
else:
|
||||
# make sure the code/encoding values are valid
|
||||
if sys.platform == "win32" and code and code[:2] == "0x":
|
||||
# map windows language identifier to language name
|
||||
code = windows_locale.get(int(code, 0))
|
||||
# ...add other platform-specific processing here, if
|
||||
# necessary...
|
||||
return code, encoding
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
Removed Windows 95 compatibility for :func:`locale.getdefaultlocale`.
|
||||
|
|
@ -555,17 +555,6 @@ _locale__getdefaultlocale_impl(PyObject *module)
|
|||
return Py_BuildValue("ss", locale, encoding);
|
||||
}
|
||||
|
||||
/* If we end up here, this windows version didn't know about
|
||||
ISO639/ISO3166 names (it's probably Windows 95). Return the
|
||||
Windows language identifier instead (a hexadecimal number) */
|
||||
|
||||
locale[0] = '0';
|
||||
locale[1] = 'x';
|
||||
if (GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_IDEFAULTLANGUAGE,
|
||||
locale+2, sizeof(locale)-2)) {
|
||||
return Py_BuildValue("ss", locale, encoding);
|
||||
}
|
||||
|
||||
/* cannot determine the language code (very unlikely) */
|
||||
return Py_BuildValue("Os", Py_None, encoding);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue