Skip to content

Commit 171e0fa

Browse files
authored
gh-123853: Cleanup Windows 95 locale fallback support (#144738)
Closes #123853
1 parent 6ea84b2 commit 171e0fa

File tree

3 files changed

+1
-15
lines changed

3 files changed

+1
-15
lines changed

Lib/locale.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -570,10 +570,6 @@ def _getdefaultlocale(envvars=('LC_ALL', 'LC_CTYPE', 'LANG', 'LANGUAGE')):
570570
except (ImportError, AttributeError):
571571
pass
572572
else:
573-
# make sure the code/encoding values are valid
574-
if sys.platform == "win32" and code and code[:2] == "0x":
575-
# map windows language identifier to language name
576-
code = windows_locale.get(int(code, 0))
577573
# ...add other platform-specific processing here, if
578574
# necessary...
579575
return code, encoding
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Removed Windows 95 compatibility for :func:`locale.getdefaultlocale`.

Modules/_localemodule.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -555,17 +555,6 @@ _locale__getdefaultlocale_impl(PyObject *module)
555555
return Py_BuildValue("ss", locale, encoding);
556556
}
557557

558-
/* If we end up here, this windows version didn't know about
559-
ISO639/ISO3166 names (it's probably Windows 95). Return the
560-
Windows language identifier instead (a hexadecimal number) */
561-
562-
locale[0] = '0';
563-
locale[1] = 'x';
564-
if (GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_IDEFAULTLANGUAGE,
565-
locale+2, sizeof(locale)-2)) {
566-
return Py_BuildValue("ss", locale, encoding);
567-
}
568-
569558
/* cannot determine the language code (very unlikely) */
570559
return Py_BuildValue("Os", Py_None, encoding);
571560
}

0 commit comments

Comments
 (0)