Default locale logical compatibility with Python 3.12 (#1054)

This commit is contained in:
liushuyu 2024-04-10 18:39:03 -06:00 committed by GitHub
parent e0abbecfe0
commit fa4a5a67bb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 0 deletions

View File

@ -63,6 +63,8 @@ jobs:
python-version: "3.10" python-version: "3.10"
- os: "ubuntu-latest" - os: "ubuntu-latest"
python-version: "3.11" python-version: "3.11"
- os: "ubuntu-latest"
python-version: "3.12"
defaults: defaults:
run: run:
@ -117,6 +119,7 @@ jobs:
# and run project-specific tasks. # and run project-specific tasks.
- name: Setup project - name: Setup project
run: | run: |
python -m pip install --upgrade pip setuptools wheel
pip install --editable=. pip install --editable=.
python setup.py compile_catalog python setup.py compile_catalog

View File

@ -219,6 +219,9 @@ class AppriseLocale:
try: try:
# Acquire our locale # Acquire our locale
lang = locale.getlocale()[0] lang = locale.getlocale()[0]
# Compatibility for Python >= 3.12
if lang == 'C':
lang = AppriseLocale._default_language
except (ValueError, TypeError) as e: except (ValueError, TypeError) as e:
# This occurs when an invalid locale was parsed from the # This occurs when an invalid locale was parsed from the