Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-123853: Cleanup Windows 95 locale fallback support#144738

Open
mokurin000 wants to merge 9 commits intopython:mainfrom
mokurin000:chore/cleanup-win95-locale
Open

gh-123853: Cleanup Windows 95 locale fallback support#144738
mokurin000 wants to merge 9 commits intopython:mainfrom
mokurin000:chore/cleanup-win95-locale

Conversation

@mokurin000
Copy link

@mokurin000mokurin000 commentedFeb 12, 2026
edited
Loading

This removed the dead codewindows_locale dict, as Windows introducedLOCALE_SISO639LANGNAME andLOCALE_SISO3166CTRYNAME since Windows 98.

Changes:

  • Removed dead codewindows_locale dict fromLib/locale.py
  • Removed0x fallback branch for Windows 95 or earlier inModules/_localemodule.c
  • Applied ruff formatting toLib/locale.py

@bedevere-app

This comment was marked as resolved.

1 similar comment
@bedevere-app

This comment was marked as resolved.

@mokurin000mokurin000force-pushed thechore/cleanup-win95-locale branch fromee5da1b to49f6613CompareFebruary 12, 2026 11:10
@bedevere-app

This comment was marked as resolved.

@mokurin000
Copy link
Author

cc.@malemburg@serhiy-storchaka

Hi! Could you take a look on these changes?

@mokurin000mokurin000force-pushed thechore/cleanup-win95-locale branch from1e06126 to2d24222CompareFebruary 12, 2026 12:18
@mokurin000mokurin000force-pushed thechore/cleanup-win95-locale branch 6 times, most recently from4f317a3 toaa0735bCompareFebruary 17, 2026 18:10
@malemburg
Copy link
Member

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

@mokurin000
Copy link
Author

mokurin000 commentedFeb 21, 2026
edited
Loading

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

As far as I know,LOCALE_SISO639LANGNAME andLOCALE_SISO3166CTRYNAME aredocumented as introduced since Windows ME/98, if that stands correctly, the hex code fallback is never getting usedsince 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 ago8f017a0, but it never get removed, and surprisingly the dictionary was maintained even after Windows 95 support were entirely removed0a86694

@mokurin000mokurin000force-pushed thechore/cleanup-win95-locale branch fromaa0735b toefd0a30CompareFebruary 21, 2026 14:33
@malemburg
Copy link
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()).

@mokurin000
Copy link
Author

mokurin000 commentedFeb 21, 2026
edited
Loading

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 ofLOCALE_SISO3166CTRYNAME,LOCALE_SISO639LANGNAME was not avaliable, forcode a None is returned, and the legacy code in that case (if ever executed) will returnNone 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

@mokurin000
Copy link
Author

mokurin000 commentedFeb 21, 2026
edited
Loading

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

@mokurin000mokurin000force-pushed thechore/cleanup-win95-locale branch 3 times, most recently from1ec8e64 to54e8f97CompareFebruary 21, 2026 15:10
@bedevere-app
Copy link

Most changes to Pythonrequire a NEWS entry. Add one using theblurb_it web app or theblurb command-line tool.

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

@mokurin000
Copy link
Author

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

@mokurin000mokurin000force-pushed thechore/cleanup-win95-locale branch from54e8f97 to5b3e6bcCompareFebruary 21, 2026 15:12
@bedevere-app
Copy link

Most changes to Pythonrequire a NEWS entry. Add one using theblurb_it web app or theblurb command-line tool.

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

Copy link
Member

@serhiy-storchakaserhiy-storchaka left a 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)?

@bedevere-app
Copy link

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 phraseI 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.

Also, `pyerrors.h` was included through `Python.h`, removing it
@mokurin000
Copy link
Author

I have made the requested changes; please review again

@bedevere-app
Copy link

Thanks for making the requested changes!

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

Copy link
Member

@serhiy-storchakaserhiy-storchaka left a comment

Choose a reason for hiding this comment

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

LGTM. 👍

}

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

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.

Choose a reason for hiding this comment

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

@bedevere-app
Copy link

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 phraseI 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.

@mokurin000
Copy link
Author

I have made the requested changes; please review again

@bedevere-app
Copy link

Thanks for making the requested changes!

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

Copy link
Member

@malemburgmalemburg left a comment

Choose a reason for hiding this comment

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

LGTM, thanks,@mokurin000

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@malemburgmalemburgmalemburg approved these changes

@serhiy-storchakaserhiy-storchakaAwaiting requested review from serhiy-storchaka

+1 more reviewer

@whyvineetwhyvineetwhyvineet left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@mokurin000@malemburg@serhiy-storchaka@whyvineet

[8]ページ先頭

©2009-2026 Movatter.jp