Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

locale.getdefaultlocale() is deprecated #249

Open
bcbnz opened this issue Jun 11, 2023 · 2 comments
Open

locale.getdefaultlocale() is deprecated #249

bcbnz opened this issue Jun 11, 2023 · 2 comments
Labels
help wanted Extra attention is needed maintenance

Comments

@bcbnz
Copy link

bcbnz commented Jun 11, 2023

The locale.getdefaultlocale() function was deprecated in Python 3.11 and will be removed in 3.13 (see the note in the library docs). The deprecation warning issued when running says use setlocale(), getencoding() and getlocale() instead.

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

def get_system_encoding():
"""
The encoding of the default system locale. Fallback to 'ascii' if the
#encoding is unsupported by Python or could not be determined. See tickets
#10335 and #5846.
"""
try:
encoding = locale.getdefaultlocale()[1] or "ascii"
codecs.lookup(encoding)
except Exception:
encoding = "ascii"
return encoding

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

@welcome
Copy link

welcome bot commented Jun 11, 2023

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! 🤗

If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively.
welcome
You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! 👋

Welcome to the Jupyter community! 🎉

@consideRatio consideRatio added help wanted Extra attention is needed maintenance labels Jun 11, 2023
@consideRatio
Copy link
Member

Thank you for detailing this so clearly @bcbnz!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed maintenance
Projects
None yet
Development

No branches or pull requests

2 participants