Skip to content

Commit f82b179

Browse files
committed
gh-128104: Remove Py_STRFTIME_C99_SUPPORT; require C99-compliant strftime
1 parent f802c8b commit f82b179

File tree

3 files changed

+4
-18
lines changed

3 files changed

+4
-18
lines changed

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.ac

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6665,7 +6665,7 @@ then
66656665
[Define if year with century should be normalized for strftime.])
66666666
fi
66676667

6668-
AC_CACHE_CHECK([whether C99-specific strftime specifiers are supported], [ac_cv_strftime_c99_support], [
6668+
AC_CACHE_CHECK([whether strftime is C99-compatible], [], [
66696669
AC_RUN_IFELSE([AC_LANG_SOURCE([[
66706670
#include <time.h>
66716671
#include <string.h>
@@ -6684,14 +6684,9 @@ int main(void)
66846684
return 1;
66856685
}
66866686
]])],
6687-
[ac_cv_strftime_c99_support=yes],
6688-
[ac_cv_strftime_c99_support=no],
6689-
[ac_cv_strftime_c99_support=no])])
6690-
if test "$ac_cv_strftime_c99_support" = yes
6691-
then
6692-
AC_DEFINE([Py_STRFTIME_C99_SUPPORT], [1],
6693-
[Define if C99-specific strftime specifiers are supported.])
6694-
fi
6687+
[],
6688+
[AC_MSG_ERROR([Python requires C99 compatible libm])],
6689+
[])])
66956690

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

pyconfig.h.in

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1712,9 +1712,6 @@
17121712
/* Define if you want to enable internal statistics gathering. */
17131713
#undef Py_STATS
17141714

1715-
/* Define if C99-specific strftime specifiers are supported. */
1716-
#undef Py_STRFTIME_C99_SUPPORT
1717-
17181715
/* The version of SunOS/Solaris as reported by `uname -r' without the dot. */
17191716
#undef Py_SUNOS_VERSION
17201717

0 commit comments

Comments
 (0)