Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix :func:`time.strftime` and :meth:`datetime.datetime.strftime` returning a
wrong ISO 8601 week number (``%V``) on OpenBSD.
7 changes: 7 additions & 0 deletions Modules/timemodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading