From 91b6bcad4d32754a0ce8c94b221e4305b32ba41e Mon Sep 17 00:00:00 2001 From: Jan Kaliszewski Date: Mon, 30 Sep 2024 04:50:07 +0200 Subject: [PATCH] Add the blurb --- .../2024-09-30-04-49-22.gh-issue-124529.hDDlMH.rst | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2024-09-30-04-49-22.gh-issue-124529.hDDlMH.rst diff --git a/Misc/NEWS.d/next/Library/2024-09-30-04-49-22.gh-issue-124529.hDDlMH.rst b/Misc/NEWS.d/next/Library/2024-09-30-04-49-22.gh-issue-124529.hDDlMH.rst new file mode 100644 index 000000000000000..330e1af44051ae2 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2024-09-30-04-49-22.gh-issue-124529.hDDlMH.rst @@ -0,0 +1,9 @@ +Fix :meth:`datetime.datetime.strptime`, :meth:`datetime.date.strptime` as +well as :func:`time.strptime` (by modifying :class:`_strptime.TimeRE`) to +make ``%c`` and ``%x`` accept year number representations consisting of +fewer digits than the usual four or two. Thanks to that, certain +``strftime/strptime`` round trips (such as +``datetime.strptime(dt.strftime("%c"), "%c"))`` for ``dt.year`` less than +1000) no longer raise ``ValueError`` for some locales/platforms (this was +the case, e.g., on Linux -- for various locales, including +``C``/``C.UTF-8``).