gh-128104: Remove `Py_STRFTIME_C99_SUPPORT`; require C99-compliant st… · python/cpython@bb2dfad · GitHub
Skip to content

Commit bb2dfad

Browse files
authored
gh-128104: Remove Py_STRFTIME_C99_SUPPORT; require C99-compliant strftime (#128106)
1 parent bb73426 commit bb2dfad

5 files changed

Lines changed: 10 additions & 27 deletions

File tree

Lines changed: 3 additions & 0 deletions

Modules/_datetimemodule.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1912,9 +1912,7 @@ wrap_strftime(PyObject *object, PyObject *format, PyObject *timetuple,
19121912
}
19131913
#ifdef Py_NORMALIZE_CENTURY
19141914
else if (ch == 'Y' || ch == 'G'
1915-
#ifdef Py_STRFTIME_C99_SUPPORT
19161915
|| ch == 'F' || ch == 'C'
1917-
#endif
19181916
) {
19191917
/* 0-pad year with century as necessary */
19201918
PyObject *item = PySequence_GetItem(timetuple, 0);
@@ -1952,15 +1950,11 @@ wrap_strftime(PyObject *object, PyObject *format, PyObject *timetuple,
19521950
* +6 to accommodate dashes, 2-digit month and day for %F. */
19531951
char buf[SIZEOF_LONG * 5 / 2 + 2 + 6];
19541952
Py_ssize_t n = PyOS_snprintf(buf, sizeof(buf),
1955-
#ifdef Py_STRFTIME_C99_SUPPORT
19561953
ch == 'F' ? "%04ld-%%m-%%d" :
1957-
#endif
19581954
"%04ld", year_long);
1959-
#ifdef Py_STRFTIME_C99_SUPPORT
19601955
if (ch == 'C') {
19611956
n -= 2;
19621957
}
1963-
#endif
19641958
if (_PyUnicodeWriter_WriteSubstring(&writer, format, start, end) < 0) {
19651959
goto Error;
19661960
}

configure

Lines changed: 4 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6672,7 +6672,7 @@ then
66726672
[Define if year with century should be normalized for strftime.])
66736673
fi
66746674

6675-
AC_CACHE_CHECK([whether C99-specific strftime specifiers are supported], [ac_cv_strftime_c99_support], [
6675+
AC_CACHE_CHECK([whether C99-compatible strftime specifiers are supported], [ac_cv_strftime_c99_support], [
66766676
AC_RUN_IFELSE([AC_LANG_SOURCE([[
66776677
#include <time.h>
66786678
#include <string.h>
@@ -6692,13 +6692,8 @@ int main(void)
66926692
}
66936693
]])],
66946694
[ac_cv_strftime_c99_support=yes],
6695-
[ac_cv_strftime_c99_support=no],
6696-
[ac_cv_strftime_c99_support=no])])
6697-
if test "$ac_cv_strftime_c99_support" = yes
6698-
then
6699-
AC_DEFINE([Py_STRFTIME_C99_SUPPORT], [1],
6700-
[Define if C99-specific strftime specifiers are supported.])
6701-
fi
6695+
[AC_MSG_ERROR([Python requires C99-compatible strftime specifiers])],
6696+
[ac_cv_strftime_c99_support=])])
67026697

67036698
dnl check for ncursesw/ncurses and panelw/panel
67046699
dnl NOTE: old curses is not detected.

pyconfig.h.in

Lines changed: 0 additions & 3 deletions

0 commit comments

Comments
 (0)