]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-154460: Do not use wcsftime() on OpenBSD (GH-154461) (GH-154476)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 22 Jul 2026 12:31:13 +0000 (14:31 +0200)
committerGitHub <noreply@github.com>
Wed, 22 Jul 2026 12:31:13 +0000 (12:31 +0000)
(cherry picked from commit f195b2e3edec8f770abdd013906379bf49176a5b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: Stan Ulbrych <stan@python.org>
Misc/NEWS.d/next/Library/2026-07-22-13-00-00.gh-issue-154460.wCsFtM.rst [new file with mode: 0644]
Modules/timemodule.c

diff --git a/Misc/NEWS.d/next/Library/2026-07-22-13-00-00.gh-issue-154460.wCsFtM.rst b/Misc/NEWS.d/next/Library/2026-07-22-13-00-00.gh-issue-154460.wCsFtM.rst
new file mode 100644 (file)
index 0000000..b0a7058
--- /dev/null
@@ -0,0 +1,2 @@
+Fix :func:`time.strftime` and :meth:`datetime.datetime.strftime` returning a
+wrong ISO 8601 week number (``%V``) on OpenBSD.
index 49626d32fd38e1b9fa682049a2a25aa21a58f3cb..e1e7454ea5178345e4a60169620121f37a3a9d28 100644 (file)
@@ -767,6 +767,13 @@ Other codes may be available on your platform.  See documentation for\n\
 the C library strftime function.\n"
 
 #ifdef HAVE_STRFTIME
+// gh-154460: OpenBSD's wcsftime() computes %V incorrectly: it returns 53
+// whenever the ISO 8601 week belongs to a different year than tm_year.
+// strftime() is not affected.
+#ifdef __OpenBSD__
+#  undef HAVE_WCSFTIME
+#endif
+
 #ifdef HAVE_WCSFTIME
 #define time_char wchar_t
 #define format_time wcsftime