Closed liushuyu closed 2 months ago
Attention: Patch coverage is 0%
with 2 lines
in your changes are missing coverage. Please review.
Project coverage is 99.26%. Comparing base (
31a4f2e
) to head (8115a10
). Report is 34 commits behind head on master.:exclamation: Current head 8115a10 differs from pull request most recent head 729f53e. Consider uploading reports for the commit 729f53e to get more accurate results
Files | Patch % | Lines |
---|---|---|
apprise/AppriseLocale.py | 0.00% | 1 Missing and 1 partial :warning: |
:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Ties to #1102; my only concern with this PR is it over-rides Python versions less than 3.12 which the test works fine for.
I think this PR may be a okay work-around for now but i'm not sure if fixing the language to us
is always the solution (consider other countries). There must be a check next if lang == C; the question is what i next (how is it done in all previous versions)?
Consider this tweak but even then i still don't accept my own answer :slightly_smiling_face:
# Based on patch already here...
import sys
if lang == 'C' and sys.version_info[0] == 3 and sys.version_info[1] == 12:
# Alternatively sys.version_info[1] >=3
lang = 'en_US' # I still question the hard-coded assignment to english.
There are discussions in the following spots that state that C.UTF-8
!= en_US.UTF-8
:
LANG=C
is a means of disabling localization (not actually setting one).I wonder if it would be better to just support C
; store it and:
That would handle the ambiguity i can't seem to let go of :wink: .
In the past, when building on different operating systems in different countries (Pre Python 3.12) when C
is set, i'm curious what the strategies are taken, and what the language flips to? Perhaps it actually does hard-code it to en_us.utf-8
?
Edit: Revisiting the code and the change made, i realize i'm already choosing en
as a hard-coded language :eyes: :man_facepalming: . So with that, I just made one small patch to reference the same constant. I'll have to revisit my own rant another day.
Thank you @liushuyu for this PR, and sorry i took so long to merge it in. I do appreciate it! Thank you for also letting me have my "old man yelling at cloud" moment! :slightly_smiling_face:
Sorry for the late reply.
Thank you @liushuyu for this PR, and sorry i took so long to merge it in. I do appreciate it! Thank you for also letting me have my "old man yelling at cloud" moment! 🙂
No problem! I could understand the underlying Python change must be a headache for the project.
In the past, when building on different operating systems in different countries (Pre Python 3.12) when
C
is set, i'm curious what the strategies are taken, and what the language flips to? Perhaps it actually does hard-code it toen_us.utf-8
?Edit: Revisiting the code and the change made, i realize i'm already choosing
en
as a hard-coded language 👀 🤦♂️ . So with that, I just made one small patch to reference the same constant. I'll have to revisit my own rant another day.
Just add to this, I think the new Python behavior is more "correct": many other languages use C.utf-8
as the fallback locale to signify that the current environment does not currently have a locale set (but still allows the program to read/interpret/pass valid Unicode data through glibc
when doing system I/O).
Description:
Related issue (if applicable): N/A
This pull request fixes the behavioural differences on Python 3.12, where if the default locale is unspecified, the new Python defaults to
C.UTF-8
instead ofen_US.UTF-8
on Unix systems.Checklist
flake8
)Testing
Anyone can help test this source code as follows: