]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.12] gh-53203: Fix strptime() for %c and %x formats on many locales (GH-124946...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sat, 12 Oct 2024 18:02:52 +0000 (20:02 +0200)
committerGitHub <noreply@github.com>
Sat, 12 Oct 2024 18:02:52 +0000 (18:02 +0000)
commit331fc017ce6afdf778464f6e9540670bb6a0fa4f
tree38fb9ceb6b45d37deb76d625b5dca79141c9c345
parente01a1784dbfe366cd2d5e22bba8b964107651bf0
[3.12] gh-53203: Fix strptime() for %c and %x formats on many locales (GH-124946) (GH-125370)

In some locales (like French or Hebrew) the full or abbreviated names of
the default month and weekday used in __calc_date_time can be part of
other name or constant part of the %c format. The month name can also
match %m with constant suffix (like in Japanese). So the code failed to
correctly distinguish formats %a, %A, %b, %B and %m.

Cycle all month and all days of the week to find the variable part
and distinguish %a from %A and %b from %B or %m.

Fixed locales for the following languges:
Arabic, Bislama, Breton, Bodo, Kashubian, Chuvash, Estonian, French, Irish,
Ge'ez, Gurajati, Manx Gaelic, Hebrew, Hindi, Chhattisgarhi, Haitian Kreyol,
Japanese, Kannada, Korean, Marathi, Malay, Norwegian, Nynorsk, Punjabi,
Rajasthani, Tok Pisin, Yoruba, Yue Chinese, Yau/Nungon and Chinese.

(cherry picked from commit c05f9dde8a12dfd63d3ade93da616042df2dc925)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Eli Bendersky <eliben@gmail.com>
Lib/_strptime.py
Lib/test/test_strptime.py
Misc/NEWS.d/next/Library/2024-10-03-20-45-57.gh-issue-53203.3Sk4Ia.rst [new file with mode: 0644]