bpo-46659: Deprecate locale.getdefaultlocale() by vstinner · Pull Request #31206 · python/cpython
Conversation
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
changed the title
bpo-43557: Deprecate locale.getdefaultlocale()
bpo-46659: Deprecate locale.getdefaultlocale()
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.
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()...
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.
vstinner
deleted the
deprecate_getdefaultlocale
branch
2trvl
mentioned this pull request