]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.12] gh-52551: Fix encoding issues in strftime() (GH-125193) (GH-125657) (GH-125661)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 17 Oct 2024 20:04:48 +0000 (22:04 +0200)
committerGitHub <noreply@github.com>
Thu, 17 Oct 2024 20:04:48 +0000 (20:04 +0000)
commit232b303e4ca47892f544294bf42e31dc34f0ec72
tree07459f79f20c74c0eba2bdae8c6f3b7da54994fb
parent5e62d9bd54b5657b7e50da9966e4cbc6ed3b520b
[3.12] gh-52551: Fix encoding issues in strftime() (GH-125193) (GH-125657) (GH-125661)

Fix time.strftime(), the strftime() method and formatting of the
datetime classes datetime, date and time.

* Characters not encodable in the current locale are now acceptable in
  the format string.
* Surrogate pairs and sequence of surrogatescape-encoded bytes are no
  longer recombinated.
* Embedded null character no longer terminates the format string.

This fixes also gh-78662 and gh-124531.

(cherry picked from commit 08ccbb9b3f5e20a7a0c4cf9995e172b59fb6067b)
(cherry picked from commit ad3eac1963a5f195ef9b2c1dbb5e44fa3cce4c72)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Lib/test/datetimetester.py
Lib/test/test_time.py
Misc/NEWS.d/next/Library/2024-10-09-17-07-33.gh-issue-52551.PBakSY.rst [new file with mode: 0644]
Modules/_datetimemodule.c
Modules/timemodule.c