Source: python-babel Version: 2.10.3-3 Severity: important Dear Maintainer,
Maybe something got broken when python was upgraded to 3.12[0]. I was fixing the autopkgtest of tkcalendat[1] tests fail with Python 3.12. I found the root cause maybe from python-babel: One test failed example on python3.12: ``` 232s ERROR: test_calendar_buttons_functions (tests.test_calendar.TestCalendar.test_calendar_buttons_functions) 232s ---------------------------------------------------------------------- 232s Traceback (most recent call last): 232s File "/tmp/autopkgtest.Ikr8jw/autopkgtest_tmp/tests/test_calendar.py", line 194, in test_calendar_buttons_functions 232s widget.selection_set(format_date(date(2018, 12, 31), 'short')) 232s ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 232s File "/tmp/autopkgtest.Ikr8jw/autopkgtest_tmp/tests/__init__.py", line 30, in format_date 232s return babel.dates.format_date(date, length, locale) 232s ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 232s File "/usr/lib/python3/dist-packages/babel/dates.py", line 726, in format_date 232s locale = Locale.parse(locale) 232s ^^^^^^^^^^^^^^^^^^^^ 232s File "/usr/lib/python3/dist-packages/babel/core.py", line 330, in parse 232s raise UnknownLocaleError(input_id) 232s babel.core.UnknownLocaleError: unknown locale 'c' ``` The `format_date` is defined here[2] ``` import babel.dates locale.setlocale(locale.LC_ALL, '') def format_date(date, length, locale=locale.getdefaultlocale()[0]): return babel.dates.format_date(date, length, locale) ``` The caller[3] is here: ``` widget._next_year() widget._remove_selection() widget.selection_set(format_date(date(2018, 12, 31), 'short')) self.assertEqual(widget.selection_get(), date(2018, 12, 31)) with self.assertRaises(ValueError): widget.selection_set("ab") widget.selection_set(None) ``` So if the locale in `format_date` is NULL, it will fail and throw away the error on python3.12: ``` babel.core.UnknownLocaleError: unknown locale 'c' ``` In face, same test case will be viewed as locale 'en_US' on python 3.11 and the same version pyhton-babel package from my debug and If I enable locale default to `en_US` the test will be passed even on python3.12. But I think the right understanding should be to be recongized by `LANG=C` by default. In fact, I should upgrade python-babel to 2.13.1(the latest release) to vertify the issus is exist or not. [0]: https://lists.debian.org/debian-python/2023/12/msg00000.html [1]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1056534 [2]: https://salsa.debian.org/python-team/packages/tkcalendar/-/blame/debian/main/tests/__init__.py#L29 [3]: https://salsa.debian.org/python-team/packages/tkcalendar/-/blob/debian/main/tests/test_calendar.py#L194 -- Regards, -- Bo YU
signature.asc
Description: PGP signature