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 — bpo-46659: Fix the MBCS codec alias on Windows by vstinner · Pull Request #31218 · python/cpython

Conversation

@vstinner

@vstinner vstinner commented Feb 8, 2022 •
edited by bedevere-bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

https://bugs.python.org/issue46659

Sorry, something went wrong.

Uh oh!

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

All reactions
@vstinner
bpo-46659: Fix the MBCS codec alias on Windows
4ff41b8
@vstinner vstinner added the skip news label Feb 8, 2022
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label Feb 8, 2022
@bedevere-bot bedevere-bot added the awaiting core review label Feb 8, 2022
@vstinner

vstinner commented Feb 8, 2022

Copy link
Copy Markdown
Member Author

@eryksun: Does this approach look good to you? It's basically restores Python 3.10 behavior. I just adjusted the test.

All reactions

Sorry, something went wrong.

Uh oh!

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

eryksun
eryksun reviewed Feb 8, 2022
View reviewed changes
Comment thread Lib/test/test_codecs.py Outdated
self.assertEqual(codec.name, "mbcs")
# Check that looking up our 'default' codepage will return
# mbcs when we don't have a more specific one available
code_page = 9999

@eryksun eryksun Feb 8, 2022

Copy link
Copy Markdown
Contributor

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.

Let's use 99999 instead, which is beyond the range of anything that Python might ever define. See code page identifiers.

Sorry, something went wrong.

Uh oh!

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

All reactions
@eryksun

eryksun commented Feb 8, 2022 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

Does this approach look good to you? It's basically restores Python 3.10 behavior. I just adjusted the test.

Yes, having a fallback for the process ANSI code page is for the best -- even though we support all of the known code pages in standard Windows locales. Thank you for clarifying the reason for its existence in the comments.

I'd prefer to also have a fallback to "oem" for the process OEM code page, but adding _winapi.GetOEMCP() is an enhancement request.

All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner
Use larger code page number
8e6a2b9
@vstinner
vstinner merged commit ccbe804 into python:main Feb 22, 2022
@bedevere-bot bedevere-bot removed the awaiting core review label Feb 22, 2022
@vstinner
vstinner deleted the mbcs_alias2 branch February 22, 2022 21:04
@vstinner

vstinner commented Feb 22, 2022

Copy link
Copy Markdown
Member Author

Thanks @eryksun for your review.

My use case is to deprecate the locale.getdefaultlocale() function. Adding an alias for the OEM page code is unrelated. If you consider that it's an useful feature, you can open a separated PR. So far, nobody requested it, so maybe it's not needed. I'm not convinced that the fallbak for the ANSI code page is used by anyone.

All reactions

Sorry, something went wrong.

Uh oh!

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

@eryksun

eryksun commented Feb 23, 2022

Copy link
Copy Markdown
Contributor

I'm not convinced that the fallbak for the ANSI code page is used by anyone.

I don't know whether the ANSI fallback is used by anyone. As I said, I've never worked with supplemental/replacement custom locales. The suggestion can be shelved until someone has an issue or explicitly requests a fallback for OEM as something required for their work environment.

All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner

vstinner commented Feb 23, 2022

Copy link
Copy Markdown
Member Author

The suggestion can be shelved until someone has an issue or explicitly requests a fallback for OEM as something required for their work environment.

It sounds perfectly reasonable :-)

All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner vstinner mentioned this pull request Feb 23, 2022
bpo-46668: Remove the mbcs alias #31174
Closed
@vstinner vstinner mentioned this pull request Dec 11, 2022
Deprecate locale.getdefaultlocale() function #90817
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@eryksun eryksun eryksun left review comments

Uh oh!

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

Assignees

No one assigned

Labels

skip news

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

@vstinner @eryksun @the-knights-who-say-ni @bedevere-bot
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.