diff options
author | Victor Stinner <vstinner@python.org> | 2022-05-25 12:21:36 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-25 12:21:36 (GMT) |
commit | 71d8775feeb647ae5003cfd466de7b58cd1bf269 (patch) | |
tree | f20e104788f22dbc11c4366dce18fc74266294a8 /configure.ac | |
parent | 9485a0dbddcee014821b41c960133632bb68b33c (diff) | |
download | cpython-71d8775feeb647ae5003cfd466de7b58cd1bf269.zip cpython-71d8775feeb647ae5003cfd466de7b58cd1bf269.tar.gz cpython-71d8775feeb647ae5003cfd466de7b58cd1bf269.tar.bz2 |
gh-93202: Always use %zd printf formatter (#93201)
Python now always use the ``%zu`` and ``%zd`` printf formats to
format a size_t or Py_ssize_t number. Building Python 3.12 requires a
C11 compiler, so these printf formats are now always supported.
* PyObject_Print() and _PyObject_Dump() now use the printf %zd format
to display an object reference count.
* Update PY_FORMAT_SIZE_T comment.
* Remove outdated notes about the %zd format in PyBytes_FromFormat()
and PyUnicode_FromFormat() documentations.
* configure no longer checks for the %zd format and no longer defines
PY_FORMAT_SIZE_T macro in pyconfig.h.
* pymacconfig.h no longer undefines PY_FORMAT_SIZE_T: macOS 10.4 is
no longer supported. Python 3.12 now requires macOS 10.6 (Snow
Leopard) or newer.
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/configure.ac b/configure.ac index bef4904..a8d499d 100644 --- a/configure.ac +++ b/configure.ac @@ -6004,52 +6004,6 @@ then LIBS="$LIBS -framework CoreFoundation" fi -AC_CACHE_CHECK([for %zd printf() format support], ac_cv_have_size_t_format, [dnl -AC_RUN_IFELSE([AC_LANG_SOURCE([[ -#include <stdio.h> -#include <stddef.h> -#include <string.h> - -#ifdef HAVE_SYS_TYPES_H -#include <sys/types.h> -#endif - -#ifdef HAVE_SSIZE_T -typedef ssize_t Py_ssize_t; -#elif SIZEOF_VOID_P == SIZEOF_LONG -typedef long Py_ssize_t; -#else -typedef int Py_ssize_t; -#endif - -int main() -{ - char buffer[256]; - - if(sprintf(buffer, "%zd", (size_t)123) < 0) - return 1; - - if (strcmp(buffer, "123")) - return 1; - - if (sprintf(buffer, "%zd", (Py_ssize_t)-123) < 0) - return 1; - - if (strcmp(buffer, "-123")) - return 1; - - return 0; -} -]])], - [ac_cv_have_size_t_format=yes], - [ac_cv_have_size_t_format=no], - [ac_cv_have_size_t_format="cross -- assuming yes" -])]) -if test "$ac_cv_have_size_t_format" != no ; then - AC_DEFINE(PY_FORMAT_SIZE_T, "z", - [Define to printf format modifier for Py_ssize_t]) -fi - AC_CHECK_TYPE(socklen_t,, AC_DEFINE(socklen_t,int, [Define to `int' if <sys/socket.h> does not define.]),[ |