[issue46659] Deprecate locale.getdefaultlocale() function

2022-02-24 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: Thanks, Victor. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: htt

[issue46659] Deprecate locale.getdefaultlocale() function

2022-02-24 Thread STINNER Victor
STINNER Victor added the comment: locale.getdefaultlocale() is now deprecated. calendar now uses locale.setlocale() instead of locale.getdefaultlocale(). The ANSI code page alias to MBCS now has better tests and better comments. Thanks Eryk Sun for your very useful feedback! -- reso

[issue46659] Deprecate locale.getdefaultlocale() function

2022-02-24 Thread STINNER Victor
STINNER Victor added the comment: New changeset 4fccf910738d1442852cb900747e6dccb8fe03ef by Victor Stinner in branch 'main': bpo-46659: Enhance LocaleTextCalendar for C locale (GH-31214) https://github.com/python/cpython/commit/4fccf910738d1442852cb900747e6dccb8fe03ef -- __

[issue46659] Deprecate locale.getdefaultlocale() function

2022-02-22 Thread STINNER Victor
STINNER Victor added the comment: New changeset b899126094731bc49fecb61f2c1b7557d74ca839 by Victor Stinner in branch 'main': bpo-46659: Deprecate locale.getdefaultlocale() (GH-31206) https://github.com/python/cpython/commit/b899126094731bc49fecb61f2c1b7557d74ca839 -- __

[issue46659] Deprecate locale.getdefaultlocale() function

2022-02-22 Thread STINNER Victor
STINNER Victor added the comment: New changeset ccbe8045faf6e63d36229ea4e1b9298572cda126 by Victor Stinner in branch 'main': bpo-46659: Fix the MBCS codec alias on Windows (GH-31218) https://github.com/python/cpython/commit/ccbe8045faf6e63d36229ea4e1b9298572cda126 -- __

[issue46659] Deprecate locale.getdefaultlocale() function

2022-02-08 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +29388 pull_request: https://github.com/python/cpython/pull/31218 ___ Python tracker ___ __

[issue46659] Deprecate locale.getdefaultlocale() function

2022-02-08 Thread STINNER Victor
STINNER Victor added the comment: Eryk: I created GH-31214 which uses the user preferred locale if the current LC_TIME locale is "C" or "POSIX". Moreover, it no longer gets the current locale when the class is created. If locale=locale is passed, just use the current LC_TIME (or the user pre

[issue46659] Deprecate locale.getdefaultlocale() function

2022-02-08 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +29384 pull_request: https://github.com/python/cpython/pull/31214 ___ Python tracker ___ __

[issue46659] Deprecate locale.getdefaultlocale() function

2022-02-08 Thread Eryk Sun
Eryk Sun added the comment: > Oh. Serhiy asked me to use LC_TIME rather than LC_CTYPE. Since Locale*Calendar is documented as not being thread safe, __init__() could get the real default via setlocale(LC_TIME, "") when locale=None and the current LC_TIME is "C". Restore it back to "C" after

[issue46659] Deprecate locale.getdefaultlocale() function

2022-02-08 Thread STINNER Victor
STINNER Victor added the comment: > I think calendar.Locale*Calendar should try the LC_CTYPE locale if LC_TIME is > "C", i.e. (None, None). Otherwise, it's introducing new default behavior. For > example, with LC_ALL set to "ru_RU.utf8": (...) Oh. Serhiy asked me to use LC_TIME rather than L

[issue46659] Deprecate locale.getdefaultlocale() function

2022-02-08 Thread STINNER Victor
STINNER Victor added the comment: Serhiy: "getdefaultlocale() falls back to LANG and LANGUAGE. It allows also to specify a list of looked up environment variables. How could this use case be covered with getlocale()?" What's your use case to use env vars rather than the current LC_CTYPE loca

[issue46659] Deprecate locale.getdefaultlocale() function

2022-02-08 Thread Eryk Sun
Eryk Sun added the comment: > getdefaultlocale() falls back to LANG and LANGUAGE. _Py_SetLocaleFromEnv(LC_CTYPE) (e.g. setlocale(LC_CTYPE, "")) gets called at startup, except for the isolated configuration [1]. I think calendar.Locale*Calendar should try the LC_CTYPE locale if LC_TIME is "C"

[issue46659] Deprecate locale.getdefaultlocale() function

2022-02-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: getdefaultlocale() falls back to LANG and LANGUAGE. It allows also to specify a list of looked up environment variables. How could this use case be covered with getlocale()? -- nosy: +serhiy.storchaka ___ Python

[issue46659] Deprecate locale.getdefaultlocale() function

2022-02-07 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +29377 pull_request: https://github.com/python/cpython/pull/31206 ___ Python tracker ___ __

[issue46659] Deprecate locale.getdefaultlocale() function

2022-02-07 Thread STINNER Victor
STINNER Victor added the comment: New changeset 7a0486eaa98083e0407ff491872db6d7a0da2635 by Victor Stinner in branch 'main': bpo-46659: calendar uses locale.getlocale() (GH-31166) https://github.com/python/cpython/commit/7a0486eaa98083e0407ff491872db6d7a0da2635 -- _

[issue46659] Deprecate locale.getdefaultlocale() function

2022-02-06 Thread STINNER Victor
STINNER Victor added the comment: > New changeset 04dd60e50cd3da48fd19cdab4c0e4cc600d6af30 by Victor Stinner in > branch 'main': > bpo-46659: Update the test on the mbcs codec alias (GH-31168) This change is not correct, I created bpo-46668 to fix it. --

[issue46659] Deprecate locale.getdefaultlocale() function

2022-02-06 Thread STINNER Victor
STINNER Victor added the comment: > Please see the discussion on https://bugs.python.org/issue43552: > locale.getpreferredencoding() needs to be deprecated as well. Instead we > should have a single locale.getencoding() as outlined there... perhaps in a > separate ticket ?! Thanks. Yeah, I

[issue46659] Deprecate locale.getdefaultlocale() function

2022-02-06 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: > For these reasons, I propose to deprecate locale.getdefaultlocale(): > setlocale(), getpreferredencoding() and getlocale() should be used instead. Please see the discussion on https://bugs.python.org/issue43552: locale.getpreferredencoding() needs to b

[issue46659] Deprecate locale.getdefaultlocale() function

2022-02-06 Thread STINNER Victor
STINNER Victor added the comment: New changeset 06b8f1615b09099fae5c5393334b8716a4144d20 by Victor Stinner in branch 'main': bpo-46659: test.support avoids locale.getdefaultlocale() (GH-31167) https://github.com/python/cpython/commit/06b8f1615b09099fae5c5393334b8716a4144d20 --

[issue46659] Deprecate locale.getdefaultlocale() function

2022-02-06 Thread STINNER Victor
STINNER Victor added the comment: New changeset 04dd60e50cd3da48fd19cdab4c0e4cc600d6af30 by Victor Stinner in branch 'main': bpo-46659: Update the test on the mbcs codec alias (GH-31168) https://github.com/python/cpython/commit/04dd60e50cd3da48fd19cdab4c0e4cc600d6af30 -- __

[issue46659] Deprecate locale.getdefaultlocale() function

2022-02-06 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +29341 pull_request: https://github.com/python/cpython/pull/31168 ___ Python tracker ___ __

[issue46659] Deprecate locale.getdefaultlocale() function

2022-02-06 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +29340 pull_request: https://github.com/python/cpython/pull/31167 ___ Python tracker ___ __

[issue46659] Deprecate locale.getdefaultlocale() function

2022-02-06 Thread STINNER Victor
Change by STINNER Victor : Added file: https://bugs.python.org/file50606/cal_locale.py ___ Python tracker ___ ___ Python-bugs-list mailing l

[issue46659] Deprecate locale.getdefaultlocale() function

2022-02-06 Thread STINNER Victor
Change by STINNER Victor : Removed file: https://bugs.python.org/file50605/cal_locale.py ___ Python tracker ___ ___ Python-bugs-list mailing

[issue46659] Deprecate locale.getdefaultlocale() function

2022-02-06 Thread STINNER Victor
STINNER Victor added the comment: cal_locale.py: Test calendar.LocaleTextCalendar() default locale, manual test for GH-31166. -- Added file: https://bugs.python.org/file50605/cal_locale.py ___ Python tracker __

[issue46659] Deprecate locale.getdefaultlocale() function

2022-02-06 Thread STINNER Victor
Change by STINNER Victor : -- keywords: +patch pull_requests: +29339 stage: -> patch review pull_request: https://github.com/python/cpython/pull/31166 ___ Python tracker ___ _

[issue46659] Deprecate locale.getdefaultlocale() function

2022-02-06 Thread STINNER Victor
New submission from STINNER Victor : The locale.getdefaultlocale() function only relies on environment variables. At Python startup, Python calls setlocale() is set the LC_CTYPE locale to the user preferred encoding. Since Python 3.7, if the LC_CTYPE locale is "C" or "POSIX", PEP 538 sets the