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: Deprecate locale.getdefaultlocale() by vstinner · Pull Request #31206 · python/cpython

Conversation

@vstinner

@vstinner vstinner commented Feb 7, 2022 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

The locale.getdefaultlocale() function is deprecated and will be removed in
Python 3.13. Use locale.setlocale(),
locale.getpreferredencoding(False) and locale.getlocale() functions
instead.

https://bugs.python.org/issue46659

Sorry, something went wrong.

Uh oh!

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

All reactions
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label Feb 7, 2022
@bedevere-bot bedevere-bot added the awaiting core review label Feb 7, 2022
@vstinner vstinner changed the title bpo-43557: Deprecate locale.getdefaultlocale() bpo-46659: Deprecate locale.getdefaultlocale() Feb 8, 2022
@vstinner

vstinner commented Feb 8, 2022

Copy link
Copy Markdown
Member Author

cc @malemburg

All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner
bpo-46659: Deprecate locale.getdefaultlocale()
abe8f1e
The locale.getdefaultlocale() function is deprecated and will be
removed in Python 3.13. Use locale.setlocale(),
locale.getpreferredencoding(False) and locale.getlocale() functions
instead.
@vstinner

vstinner commented Feb 8, 2022

Copy link
Copy Markdown
Member Author

cc @serhiy-storchaka @methane

All reactions

Sorry, something went wrong.

Uh oh!

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

@methane

methane commented Feb 9, 2022

Copy link
Copy Markdown
Member

Locale is too difficult to me, so I can not say LGTM.
At least, I feel it is very tempting API that can be used to get preferred language without calling setlocale()...

All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner

vstinner commented Feb 11, 2022 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member Author

At least, I feel it is very tempting API that can be used to get preferred language without calling setlocale()...

The function is convenient until you fall into a case where it doesn't work as expected. It's similar to mixing Python 2 str and unicode types. It works in most cases, until someone enters a name with a single non-ASCII character, and then suddently everything fall apart.

All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner
vstinner merged commit b899126 into python:main Feb 22, 2022
@vstinner
vstinner deleted the deprecate_getdefaultlocale branch February 22, 2022 21:06
@bedevere-bot bedevere-bot removed the awaiting core review label Feb 22, 2022
@vstinner vstinner mentioned this pull request Apr 10, 2022
Deprecate getlocale() and normalize() functions #87723
Closed
@vstinner vstinner mentioned this pull request Dec 11, 2022
Deprecate locale.getdefaultlocale() function #90817
Closed
@2trvl 2trvl mentioned this pull request Mar 7, 2025
Deprecation of locale.getdefaultlocale breaks POSIX compatibility on Windows platform #130796
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

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

@vstinner @methane @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.