gh-128104: Remove Py_STRFTIME_C99_SUPPORT
; require C99-compliant strftime (#128106)
This commit is contained in:
parent
bb73426caf
commit
bb2dfadb92
@ -0,0 +1,3 @@
|
|||||||
|
Remove ``Py_STRFTIME_C99_SUPPORT`` conditions in favor of requiring C99
|
||||||
|
:manpage:`strftime(3)` specifier support at build time. When cross-compiling,
|
||||||
|
there is no build time check and support is assumed.
|
@ -1912,9 +1912,7 @@ wrap_strftime(PyObject *object, PyObject *format, PyObject *timetuple,
|
|||||||
}
|
}
|
||||||
#ifdef Py_NORMALIZE_CENTURY
|
#ifdef Py_NORMALIZE_CENTURY
|
||||||
else if (ch == 'Y' || ch == 'G'
|
else if (ch == 'Y' || ch == 'G'
|
||||||
#ifdef Py_STRFTIME_C99_SUPPORT
|
|
||||||
|| ch == 'F' || ch == 'C'
|
|| ch == 'F' || ch == 'C'
|
||||||
#endif
|
|
||||||
) {
|
) {
|
||||||
/* 0-pad year with century as necessary */
|
/* 0-pad year with century as necessary */
|
||||||
PyObject *item = PySequence_GetItem(timetuple, 0);
|
PyObject *item = PySequence_GetItem(timetuple, 0);
|
||||||
@ -1952,15 +1950,11 @@ wrap_strftime(PyObject *object, PyObject *format, PyObject *timetuple,
|
|||||||
* +6 to accommodate dashes, 2-digit month and day for %F. */
|
* +6 to accommodate dashes, 2-digit month and day for %F. */
|
||||||
char buf[SIZEOF_LONG * 5 / 2 + 2 + 6];
|
char buf[SIZEOF_LONG * 5 / 2 + 2 + 6];
|
||||||
Py_ssize_t n = PyOS_snprintf(buf, sizeof(buf),
|
Py_ssize_t n = PyOS_snprintf(buf, sizeof(buf),
|
||||||
#ifdef Py_STRFTIME_C99_SUPPORT
|
|
||||||
ch == 'F' ? "%04ld-%%m-%%d" :
|
ch == 'F' ? "%04ld-%%m-%%d" :
|
||||||
#endif
|
|
||||||
"%04ld", year_long);
|
"%04ld", year_long);
|
||||||
#ifdef Py_STRFTIME_C99_SUPPORT
|
|
||||||
if (ch == 'C') {
|
if (ch == 'C') {
|
||||||
n -= 2;
|
n -= 2;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if (_PyUnicodeWriter_WriteSubstring(&writer, format, start, end) < 0) {
|
if (_PyUnicodeWriter_WriteSubstring(&writer, format, start, end) < 0) {
|
||||||
goto Error;
|
goto Error;
|
||||||
}
|
}
|
||||||
|
14
configure
generated
vendored
14
configure
generated
vendored
@ -26436,8 +26436,8 @@ printf "%s\n" "#define Py_NORMALIZE_CENTURY 1" >>confdefs.h
|
|||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C99-specific strftime specifiers are supported" >&5
|
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C99-compatible strftime specifiers are supported" >&5
|
||||||
printf %s "checking whether C99-specific strftime specifiers are supported... " >&6; }
|
printf %s "checking whether C99-compatible strftime specifiers are supported... " >&6; }
|
||||||
if test ${ac_cv_strftime_c99_support+y}
|
if test ${ac_cv_strftime_c99_support+y}
|
||||||
then :
|
then :
|
||||||
printf %s "(cached) " >&6
|
printf %s "(cached) " >&6
|
||||||
@ -26445,7 +26445,7 @@ else $as_nop
|
|||||||
|
|
||||||
if test "$cross_compiling" = yes
|
if test "$cross_compiling" = yes
|
||||||
then :
|
then :
|
||||||
ac_cv_strftime_c99_support=no
|
ac_cv_strftime_c99_support=
|
||||||
else $as_nop
|
else $as_nop
|
||||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
/* end confdefs.h. */
|
/* end confdefs.h. */
|
||||||
@ -26472,7 +26472,7 @@ if ac_fn_c_try_run "$LINENO"
|
|||||||
then :
|
then :
|
||||||
ac_cv_strftime_c99_support=yes
|
ac_cv_strftime_c99_support=yes
|
||||||
else $as_nop
|
else $as_nop
|
||||||
ac_cv_strftime_c99_support=no
|
as_fn_error $? "Python requires C99-compatible strftime specifiers" "$LINENO" 5
|
||||||
fi
|
fi
|
||||||
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
|
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
|
||||||
conftest.$ac_objext conftest.beam conftest.$ac_ext
|
conftest.$ac_objext conftest.beam conftest.$ac_ext
|
||||||
@ -26481,12 +26481,6 @@ fi
|
|||||||
fi
|
fi
|
||||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_strftime_c99_support" >&5
|
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_strftime_c99_support" >&5
|
||||||
printf "%s\n" "$ac_cv_strftime_c99_support" >&6; }
|
printf "%s\n" "$ac_cv_strftime_c99_support" >&6; }
|
||||||
if test "$ac_cv_strftime_c99_support" = yes
|
|
||||||
then
|
|
||||||
|
|
||||||
printf "%s\n" "#define Py_STRFTIME_C99_SUPPORT 1" >>confdefs.h
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
have_curses=no
|
have_curses=no
|
||||||
have_panel=no
|
have_panel=no
|
||||||
|
11
configure.ac
11
configure.ac
@ -6672,7 +6672,7 @@ then
|
|||||||
[Define if year with century should be normalized for strftime.])
|
[Define if year with century should be normalized for strftime.])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_CACHE_CHECK([whether C99-specific strftime specifiers are supported], [ac_cv_strftime_c99_support], [
|
AC_CACHE_CHECK([whether C99-compatible strftime specifiers are supported], [ac_cv_strftime_c99_support], [
|
||||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -6692,13 +6692,8 @@ int main(void)
|
|||||||
}
|
}
|
||||||
]])],
|
]])],
|
||||||
[ac_cv_strftime_c99_support=yes],
|
[ac_cv_strftime_c99_support=yes],
|
||||||
[ac_cv_strftime_c99_support=no],
|
[AC_MSG_ERROR([Python requires C99-compatible strftime specifiers])],
|
||||||
[ac_cv_strftime_c99_support=no])])
|
[ac_cv_strftime_c99_support=])])
|
||||||
if test "$ac_cv_strftime_c99_support" = yes
|
|
||||||
then
|
|
||||||
AC_DEFINE([Py_STRFTIME_C99_SUPPORT], [1],
|
|
||||||
[Define if C99-specific strftime specifiers are supported.])
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnl check for ncursesw/ncurses and panelw/panel
|
dnl check for ncursesw/ncurses and panelw/panel
|
||||||
dnl NOTE: old curses is not detected.
|
dnl NOTE: old curses is not detected.
|
||||||
|
@ -1715,9 +1715,6 @@
|
|||||||
/* Define if you want to enable internal statistics gathering. */
|
/* Define if you want to enable internal statistics gathering. */
|
||||||
#undef Py_STATS
|
#undef Py_STATS
|
||||||
|
|
||||||
/* Define if C99-specific strftime specifiers are supported. */
|
|
||||||
#undef Py_STRFTIME_C99_SUPPORT
|
|
||||||
|
|
||||||
/* The version of SunOS/Solaris as reported by `uname -r' without the dot. */
|
/* The version of SunOS/Solaris as reported by `uname -r' without the dot. */
|
||||||
#undef Py_SUNOS_VERSION
|
#undef Py_SUNOS_VERSION
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user