GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-123853: Cleanup Windows 95 locale fallback support by mokurin000 · Pull Request #144738 · python/cpython

Conversation

@mokurin000

@mokurin000 mokurin000 commented Feb 12, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

This removed the dead code windows_locale dict, as Windows introduced LOCALE_SISO639LANGNAME and LOCALE_SISO3166CTRYNAME since Windows 98.

Changes:

  • Removed dead code windows_locale dict from Lib/locale.py
  • Removed 0x fallback branch for Windows 95 or earlier in Modules/_localemodule.c
  • Applied ruff formatting to Lib/locale.py

  • Issue: locale.windows_locale: Incorrect Windows locale for Cambodian #123853

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-app bedevere-app Bot added the awaiting review label Feb 12, 2026
@bedevere-app bedevere-app Bot mentioned this pull request Feb 12, 2026
locale.windows_locale: Incorrect Windows locale for Cambodian #123853
Closed
@bedevere-app

This comment was marked as resolved.

Sign in to view
1 similar comment
@bedevere-app

This comment was marked as resolved.

Sign in to view
@mokurin000
mokurin000 force-pushed the chore/cleanup-win95-locale branch from ee5da1b to 49f6613 Compare February 12, 2026 11:10
@bedevere-app

This comment was marked as resolved.

Sign in to view
@mokurin000

mokurin000 commented Feb 12, 2026

Copy link
Copy Markdown
Contributor Author

cc. @malemburg @serhiy-storchaka

Hi! Could you take a look on these changes?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mokurin000
mokurin000 force-pushed the chore/cleanup-win95-locale branch from 1e06126 to 2d24222 Compare February 12, 2026 12:18
whyvineet
whyvineet reviewed Feb 12, 2026
View reviewed changes
Comment thread Lib/locale.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@mokurin000
mokurin000 force-pushed the chore/cleanup-win95-locale branch 6 times, most recently from 4f317a3 to aa0735b Compare February 17, 2026 18:10
@malemburg

malemburg commented Feb 21, 2026

Copy link
Copy Markdown
Member

Are you sure that _locale._getdefaultlocale() will no longer return a Windows locale code ?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mokurin000

mokurin000 commented Feb 21, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

Are you sure that _locale._getdefaultlocale() will no longer return a Windows locale code ?

As far as I know, LOCALE_SISO639LANGNAME and LOCALE_SISO3166CTRYNAME are documented as introduced since Windows ME/98, if that stands correctly, the hex code fallback is never getting used since Python 2.6, which dropped support to Windows 95/98/ME (NT 4).

Looking into git blame, the fallback code was written at 26 years ago 8f017a0, but it never get removed, and surprisingly the dictionary was maintained even after Windows 95 support were entirely removed 0a86694

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mokurin000
mokurin000 force-pushed the chore/cleanup-win95-locale branch from aa0735b to efd0a30 Compare February 21, 2026 14:33
@malemburg

malemburg commented Feb 21, 2026

Copy link
Copy Markdown
Member

I think we should still leave a guard in the code, so that such codes do not leak outside the function. The guard should raise an exception and let the user know that something is wrong.

Also, please have a look on Github whether the windows_locale is in use by Python 3 code. We may have to do a deprecation cycle (though it was already indirectly put through this as part of the now undone deprecation of getdefaultencoding()).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mokurin000

mokurin000 commented Feb 21, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

I think we should still leave a guard in the code, so that such codes do not leak outside the function. The guard should raise an exception and let the user know that something is wrong.

With the current mechanism, if any of LOCALE_SISO3166CTRYNAME, LOCALE_SISO639LANGNAME was not avaliable, for code a None is returned, and the legacy code in that case (if ever executed) will return None as code when the hex code not found in windows_locale
I will add that into documentation

Also, please have a look on Github whether the windows_locale is in use by Python 3 code. We may have to do a deprecation cycle (though it was already indirectly put through this as part of the now undone deprecation of getdefaultencoding()).

Okay, I will do so soon as have time

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mokurin000

mokurin000 commented Feb 21, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

Right, undocumented though, there are many code relying on the windows_locale dictionary, it cannot be simply removed..
By the way, where shall I mark a dictionary as deprecated?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mokurin000
mokurin000 force-pushed the chore/cleanup-win95-locale branch 3 times, most recently from 1ec8e64 to 54e8f97 Compare February 21, 2026 15:10
@bedevere-app

bedevere-app Bot commented Feb 21, 2026

Copy link
Copy Markdown

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mokurin000

mokurin000 commented Feb 21, 2026

Copy link
Copy Markdown
Contributor Author

Now I believe it does no impact to python users, removed the NEWS entry

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mokurin000
mokurin000 force-pushed the chore/cleanup-win95-locale branch from 54e8f97 to 5b3e6bc Compare February 21, 2026 15:12
@bedevere-app

bedevere-app Bot commented Feb 21, 2026

Copy link
Copy Markdown

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@serhiy-storchaka
serhiy-storchaka self-requested a review February 21, 2026 16:54
serhiy-storchaka
serhiy-storchaka reviewed Feb 21, 2026
View reviewed changes

@serhiy-storchaka serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should not _locale._getdefaultlocale() raise an exception if the locale is not found (this should never happen on modern Windows)?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
serhiy-storchaka
serhiy-storchaka reviewed Feb 26, 2026
View reviewed changes
Comment thread Lib/locale.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Modules/_localemodule.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

mokurin000 added 2 commits February 27, 2026 02:17
@mokurin000
chore: remove exception raising for backword compatibility
7c9b9fe
@mokurin000
docs: minify diff lines
583c63a
@mokurin000

mokurin000 commented Feb 26, 2026

Copy link
Copy Markdown
Contributor Author

I have made the requested changes; please review again

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot added awaiting change review and removed awaiting changes labels Feb 26, 2026
@bedevere-app

bedevere-app Bot commented Feb 26, 2026

Copy link
Copy Markdown

Thanks for making the requested changes!

@malemburg: please review the changes made to this pull request.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

serhiy-storchaka
serhiy-storchaka approved these changes Feb 26, 2026
View reviewed changes

@serhiy-storchaka serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. 👍

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting change review labels Feb 26, 2026
malemburg
malemburg requested changes Feb 26, 2026
View reviewed changes
Comment thread Modules/_localemodule.c Outdated
}

/* cannot determine the language code (very unlikely) */
Py_INCREF(Py_None);

@malemburg malemburg Feb 26, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIR, Py_BuildValue("O") takes care of the INCREF for you, so this should not be needed.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@serhiy-storchaka serhiy-storchaka Feb 26, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #145250.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-app bedevere-app Bot added awaiting changes and removed awaiting merge labels Feb 26, 2026
@bedevere-app

bedevere-app Bot commented Feb 26, 2026

Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@serhiy-storchaka
Merge branch 'main' into chore/cleanup-win95-locale
636bbf7
@mokurin000

mokurin000 commented Feb 27, 2026

Copy link
Copy Markdown
Contributor Author

I have made the requested changes; please review again

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot added awaiting change review and removed awaiting changes labels Feb 27, 2026
@bedevere-app

bedevere-app Bot commented Feb 27, 2026

Copy link
Copy Markdown

Thanks for making the requested changes!

@malemburg, @serhiy-storchaka: please review the changes made to this pull request.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app
bedevere-app Bot requested review from malemburg and serhiy-storchaka February 27, 2026 08:22
malemburg
malemburg approved these changes Feb 27, 2026
View reviewed changes

@malemburg malemburg left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks, @mokurin000

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting change review labels Feb 27, 2026
@malemburg
malemburg merged commit 171e0fa into python:main Feb 27, 2026
52 of 55 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting merge label Feb 27, 2026
brijkapadia pushed a commit to brijkapadia/cpython that referenced this pull request Feb 28, 2026
@mokurin000 @brijkapadia
pythongh-123853: Cleanup Windows 95 locale fallback support (python#1…
6bedc25
…44738)

Closes python#123853
ljfp pushed a commit to ljfp/cpython that referenced this pull request Apr 25, 2026
@mokurin000 @ljfp
pythongh-123853: Cleanup Windows 95 locale fallback support (python#1…
1127156
…44738)

Closes python#123853
@mokurin000
mokurin000 deleted the chore/cleanup-win95-locale branch June 17, 2026 08:35
@seanbudd seanbudd mentioned this pull request Jul 10, 2026
Python to 3.13.14 nvaccess/nvda#20476
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@malemburg malemburg malemburg approved these changes
@serhiy-storchaka serhiy-storchaka Awaiting requested review from serhiy-storchaka
+1 more reviewer
@whyvineet whyvineet whyvineet left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@mokurin000 @malemburg @serhiy-storchaka @whyvineet
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.