jupyterhub / jupyterhub/nativeauthenticator

locale.getdefaultlocale() is deprecated

Open
#249 2 comments 0 reactions 0 assignees View on GitHub
help wanted maintenance
Dominant language
Python
Stars
81
Forks
68
PR merge metrics
No merged PRs in 30d

Description

The `locale.getdefaultlocale()` function was deprecated in Python 3.11 and will be removed in 3.13 (see the note in [the library docs](https://docs.python.org/3/library/locale.html#locale.getdefaultlocale)). The deprecation warning issued when running says `use setlocale(), getencoding() and getlocale() instead`.

The only place it is used is crypto/encoding.py:

https://github.com/jupyterhub/nativeauthenticator/blob/3db8285e0b1f8296d41b1f5b1d2016852a50dc40/nativeauthenticator/crypto/encoding.py#L187-L198

I guess either `locale.getencoding()` or `locale.getpreferredencoding` would be a suitable replacement.

Contributor guide

Open the contributing guide

Research direction

Read crypto/encoding.py at the usage linked around lines 187–198 and compare the deprecated locale.getdefaultlocale() call with the documented alternatives, including locale.getencoding() and locale.getpreferredencoding(). Confirm that the replacement removes the Python 3.11 deprecation warning and continues to provide the needed encoding behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, security
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.