https://github.com/python/cpython/commit/a32139044a80b8973ff8e547448a2549a8f87ad9
commit: a32139044a80b8973ff8e547448a2549a8f87ad9
branch: main
author: Victor Stinner <[email protected]>
committer: vstinner <[email protected]>
date: 2026-09-22T06:00:28Z
summary:

gh-157695: Rename HAVE_ACOSPI to _Py_HAVE_ACOSPI (#157858)

configure.ac: Add PY_CHECK_FUNC_PRIVATE() function, similar to
PY_CHECK_FUNC() but defines macro _Py_HAVE_xxx instead of HAVE_xxx.

Use PY_CHECK_FUNC_PRIVATE() for functions: acospi, asinpi, atanpi,
atan2pi, cospi, sinpi and tanpi. Update check_capi_macros_ignored.txt.

files:
M Modules/mathmodule.c
M Tools/build/check_capi_macros_ignored.txt
M configure
M configure.ac
M pyconfig.h.in

diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c
index 16e7231214af2d..5e100da7a42417 100644
--- a/Modules/mathmodule.c
+++ b/Modules/mathmodule.c
@@ -212,7 +212,7 @@ static const double logpi = 
1.144729885849400174143427351353058711647;
         }                                                  \
     }
 
-#ifndef HAVE_ACOSPI
+#ifndef _Py_HAVE_ACOSPI
 /*
    acos(x)/pi.  It conforms to C23 Annex 'F'.
 */
@@ -236,7 +236,7 @@ m_acospi(double x)
 #define m_acospi acospi
 #endif
 
-#ifndef HAVE_ASINPI
+#ifndef _Py_HAVE_ASINPI
 /*
    asin(x)/pi.  It conforms to C23 Annex 'F'.
 */
@@ -254,7 +254,7 @@ m_asinpi(double x)
 #define m_asinpi asinpi
 #endif
 
-#ifndef HAVE_ATANPI
+#ifndef _Py_HAVE_ATANPI
 /*
    atan(x)/pi.  It conforms to C23 Annex 'F'.
 */
@@ -272,7 +272,7 @@ m_atanpi(double x)
 #define m_atanpi atanpi
 #endif
 
-#ifndef HAVE_ATAN2PI
+#ifndef _Py_HAVE_ATAN2PI
 /*
    atan2(y, x)/pi.  It conforms to C23 Annex 'F'.
 */
@@ -290,7 +290,7 @@ m_atan2pi(double y, double x)
 #define m_atan2pi atan2pi
 #endif
 
-#ifndef HAVE_COSPI
+#ifndef _Py_HAVE_COSPI
 /*
    cos(pi*x), giving accurate results for all finite x (especially x
    integral or close to an integer).  It conforms to C23 Annex 'F'.
@@ -318,7 +318,7 @@ m_cospi(double x)
 #define m_cospi cospi
 #endif
 
-#ifndef HAVE_SINPI
+#ifndef _Py_HAVE_SINPI
 /*
    sin(pi*x), giving accurate results for all finite x (especially x
    integral or close to an integer).  It conforms to C23 Annex 'F'.
@@ -362,7 +362,7 @@ m_sinpi(double x)
 #define m_sinpi sinpi
 #endif
 
-#ifndef HAVE_TANPI
+#ifndef _Py_HAVE_TANPI
 /*
    tan(pi*x), giving accurate results for all finite x (especially x
    integral or close to an integer).  It conforms to C23 Annex 'F'.
diff --git a/Tools/build/check_capi_macros_ignored.txt 
b/Tools/build/check_capi_macros_ignored.txt
index fde90882d7dcf4..877c8d72e72827 100644
--- a/Tools/build/check_capi_macros_ignored.txt
+++ b/Tools/build/check_capi_macros_ignored.txt
@@ -73,18 +73,14 @@ GETPGRP_HAVE_ARG
 HAVE_ACCEPT
 HAVE_ACCEPT4
 HAVE_ACOSH
-HAVE_ACOSPI
 HAVE_ADDRINFO
 HAVE_ALARM
 HAVE_ALIGNED_REQUIRED
 HAVE_ALLOCA_H
 HAVE_ALTZONE
 HAVE_ASINH
-HAVE_ASINPI
 HAVE_ASM_TYPES_H
-HAVE_ATAN2PI
 HAVE_ATANH
-HAVE_ATANPI
 HAVE_BACKTRACE
 HAVE_BIND
 HAVE_BIND_TEXTDOMAIN_CODESET
@@ -118,7 +114,6 @@ HAVE_CONFSTR
 HAVE_CONIO_H
 HAVE_CONNECT
 HAVE_COPY_FILE_RANGE
-HAVE_COSPI
 HAVE_CTERMID
 HAVE_CTERMID_R
 HAVE_CURSES_DEFINE_KEY
@@ -510,7 +505,6 @@ HAVE_SIGRELSE
 HAVE_SIGTIMEDWAIT
 HAVE_SIGWAIT
 HAVE_SIGWAITINFO
-HAVE_SINPI
 HAVE_SNPRINTF
 HAVE_SOCKADDR_ALG
 HAVE_SOCKADDR_SA_LEN
@@ -602,7 +596,6 @@ HAVE_SYS_UN_H
 HAVE_SYS_UTSNAME_H
 HAVE_SYS_WAIT_H
 HAVE_SYS_XATTR_H
-HAVE_TANPI
 HAVE_TCGETPGRP
 HAVE_TCSETPGRP
 HAVE_TEMPNAM
diff --git a/configure b/configure
index 503afe8c2d6779..84f2030049ac31 100755
--- a/configure
+++ b/configure
@@ -642,7 +642,6 @@ ac_includes_default="\
 #endif"
 
 ac_header_c_list=
-ac_func_c_list=
 ac_subst_vars='LTLIBOBJS
 MODULE_BLOCK
 JIT_SHIM_BUILD_O
@@ -3440,13 +3439,6 @@ as_fn_append ac_header_c_list " sys/types.h sys_types_h 
HAVE_SYS_TYPES_H"
 as_fn_append ac_header_c_list " unistd.h unistd_h HAVE_UNISTD_H"
 as_fn_append ac_header_c_list " wchar.h wchar_h HAVE_WCHAR_H"
 as_fn_append ac_header_c_list " minix/config.h minix_config_h 
HAVE_MINIX_CONFIG_H"
-as_fn_append ac_func_c_list " acospi HAVE_ACOSPI"
-as_fn_append ac_func_c_list " asinpi HAVE_ASINPI"
-as_fn_append ac_func_c_list " atanpi HAVE_ATANPI"
-as_fn_append ac_func_c_list " atan2pi HAVE_ATAN2PI"
-as_fn_append ac_func_c_list " cospi HAVE_COSPI"
-as_fn_append ac_func_c_list " sinpi HAVE_SINPI"
-as_fn_append ac_func_c_list " tanpi HAVE_TANPI"
 
 # Auxiliary files required by this configure script.
 ac_aux_files="install-sh config.guess config.sub"
@@ -3625,6 +3617,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 
+
+
 if test "$srcdir" != . -a "$srcdir" != "$(pwd)"; then
     # If we're building out-of-tree, we need to make sure the following
     # resources get picked up before their $srcdir counterparts.
@@ -27589,24 +27583,298 @@ fi
 
 done
 
-ac_func=
-for ac_item in $ac_func_c_list
-do
-  if test $ac_func; then
-    ac_fn_c_check_func "$LINENO" $ac_func ac_cv_func_$ac_func
-    if eval test \"x\$ac_cv_func_$ac_func\" = xyes; then
-      echo "#define $ac_item 1" >> confdefs.h
-    fi
-    ac_func=
-  else
-    ac_func=$ac_item
-  fi
-done
+
+
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for acospi" >&5
+printf %s "checking for acospi... " >&6; }
+if test ${ac_cv_func_acospi+y}
+then :
+  printf %s "(cached) " >&6
+else case e in #(
+  e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main (void)
+{
+void *x=acospi
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"
+then :
+  ac_cv_func_acospi=yes
+else case e in #(
+  e) ac_cv_func_acospi=no ;;
+esac
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+   ;;
+esac
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_acospi" >&5
+printf "%s\n" "$ac_cv_func_acospi" >&6; }
+  if test "x$ac_cv_func_acospi" = xyes
+then :
+
+printf "%s\n" "#define _Py_HAVE_ACOSPI 1" >>confdefs.h
+
+fi
+
+
+
+
+
+
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for asinpi" >&5
+printf %s "checking for asinpi... " >&6; }
+if test ${ac_cv_func_asinpi+y}
+then :
+  printf %s "(cached) " >&6
+else case e in #(
+  e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main (void)
+{
+void *x=asinpi
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"
+then :
+  ac_cv_func_asinpi=yes
+else case e in #(
+  e) ac_cv_func_asinpi=no ;;
+esac
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+   ;;
+esac
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_asinpi" >&5
+printf "%s\n" "$ac_cv_func_asinpi" >&6; }
+  if test "x$ac_cv_func_asinpi" = xyes
+then :
+
+printf "%s\n" "#define _Py_HAVE_ASINPI 1" >>confdefs.h
+
+fi
+
+
+
+
+
+
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for atanpi" >&5
+printf %s "checking for atanpi... " >&6; }
+if test ${ac_cv_func_atanpi+y}
+then :
+  printf %s "(cached) " >&6
+else case e in #(
+  e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main (void)
+{
+void *x=atanpi
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"
+then :
+  ac_cv_func_atanpi=yes
+else case e in #(
+  e) ac_cv_func_atanpi=no ;;
+esac
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+   ;;
+esac
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_atanpi" >&5
+printf "%s\n" "$ac_cv_func_atanpi" >&6; }
+  if test "x$ac_cv_func_atanpi" = xyes
+then :
+
+printf "%s\n" "#define _Py_HAVE_ATANPI 1" >>confdefs.h
+
+fi
+
+
+
+
+
+
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for atan2pi" >&5
+printf %s "checking for atan2pi... " >&6; }
+if test ${ac_cv_func_atan2pi+y}
+then :
+  printf %s "(cached) " >&6
+else case e in #(
+  e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main (void)
+{
+void *x=atan2pi
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"
+then :
+  ac_cv_func_atan2pi=yes
+else case e in #(
+  e) ac_cv_func_atan2pi=no ;;
+esac
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+   ;;
+esac
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_atan2pi" >&5
+printf "%s\n" "$ac_cv_func_atan2pi" >&6; }
+  if test "x$ac_cv_func_atan2pi" = xyes
+then :
+
+printf "%s\n" "#define _Py_HAVE_ATAN2PI 1" >>confdefs.h
+
+fi
+
+
+
+
+
+
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for cospi" >&5
+printf %s "checking for cospi... " >&6; }
+if test ${ac_cv_func_cospi+y}
+then :
+  printf %s "(cached) " >&6
+else case e in #(
+  e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main (void)
+{
+void *x=cospi
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"
+then :
+  ac_cv_func_cospi=yes
+else case e in #(
+  e) ac_cv_func_cospi=no ;;
+esac
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+   ;;
+esac
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_cospi" >&5
+printf "%s\n" "$ac_cv_func_cospi" >&6; }
+  if test "x$ac_cv_func_cospi" = xyes
+then :
+
+printf "%s\n" "#define _Py_HAVE_COSPI 1" >>confdefs.h
+
+fi
+
+
+
+
+
+
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sinpi" >&5
+printf %s "checking for sinpi... " >&6; }
+if test ${ac_cv_func_sinpi+y}
+then :
+  printf %s "(cached) " >&6
+else case e in #(
+  e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main (void)
+{
+void *x=sinpi
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"
+then :
+  ac_cv_func_sinpi=yes
+else case e in #(
+  e) ac_cv_func_sinpi=no ;;
+esac
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+   ;;
+esac
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_sinpi" >&5
+printf "%s\n" "$ac_cv_func_sinpi" >&6; }
+  if test "x$ac_cv_func_sinpi" = xyes
+then :
+
+printf "%s\n" "#define _Py_HAVE_SINPI 1" >>confdefs.h
+
+fi
+
 
 
 
 
 
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for tanpi" >&5
+printf %s "checking for tanpi... " >&6; }
+if test ${ac_cv_func_tanpi+y}
+then :
+  printf %s "(cached) " >&6
+else case e in #(
+  e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main (void)
+{
+void *x=tanpi
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"
+then :
+  ac_cv_func_tanpi=yes
+else case e in #(
+  e) ac_cv_func_tanpi=no ;;
+esac
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+   ;;
+esac
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_tanpi" >&5
+printf "%s\n" "$ac_cv_func_tanpi" >&6; }
+  if test "x$ac_cv_func_tanpi" = xyes
+then :
+
+printf "%s\n" "#define _Py_HAVE_TANPI 1" >>confdefs.h
+
+fi
+
+
 
 
 LIBS=$LIBS_SAVE
diff --git a/configure.ac b/configure.ac
index abf867c152f1a4..bc94908213d2c7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -73,6 +73,12 @@ AC_DEFUN([PY_CHECK_FUNC],
   AS_VAR_POPDEF([py_define])
 ])
 
+dnl PY_CHECK_FUNC_PRIVATE(FUNCTION, [INCLUDES], [AC_DEFINE-VAR])
+dnl Similar to PY_CHECK_FUNC but define macro _Py_HAVE_xxx instead of HAVE_xxx
+AC_DEFUN([PY_CHECK_FUNC_PRIVATE],
+[ PY_CHECK_FUNC([$1], [$2], m4_ifblank([$3], [[_Py_HAVE_]m4_toupper($1)], 
[$3]))
+])
+
 dnl PY_CHECK_LIB(LIBRARY, FUNCTION, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], 
[OTHER-LIBRARIES])
 dnl Like AC_CHECK_LIB() but does not modify LIBS
 AC_DEFUN([PY_CHECK_LIB],
@@ -6549,7 +6555,13 @@ AC_CHECK_FUNCS(
   [AC_MSG_ERROR([Python requires C99 compatible libm])]
 )
 
-AC_CHECK_FUNCS_ONCE(acospi asinpi atanpi atan2pi cospi sinpi tanpi)
+PY_CHECK_FUNC_PRIVATE([acospi])
+PY_CHECK_FUNC_PRIVATE([asinpi])
+PY_CHECK_FUNC_PRIVATE([atanpi])
+PY_CHECK_FUNC_PRIVATE([atan2pi])
+PY_CHECK_FUNC_PRIVATE([cospi])
+PY_CHECK_FUNC_PRIVATE([sinpi])
+PY_CHECK_FUNC_PRIVATE([tanpi])
 LIBS=$LIBS_SAVE
 
 dnl For multiprocessing module, check that sem_open
diff --git a/pyconfig.h.in b/pyconfig.h.in
index b85932b5848586..d1de60ad757f4d 100644
--- a/pyconfig.h.in
+++ b/pyconfig.h.in
@@ -55,9 +55,6 @@
 /* Define to 1 if you have the 'acosh' function. */
 #undef HAVE_ACOSH
 
-/* Define to 1 if you have the 'acospi' function. */
-#undef HAVE_ACOSPI
-
 /* struct addrinfo (netdb.h) */
 #undef HAVE_ADDRINFO
 
@@ -76,21 +73,12 @@
 /* Define to 1 if you have the 'asinh' function. */
 #undef HAVE_ASINH
 
-/* Define to 1 if you have the 'asinpi' function. */
-#undef HAVE_ASINPI
-
 /* Define to 1 if you have the <asm/types.h> header file. */
 #undef HAVE_ASM_TYPES_H
 
-/* Define to 1 if you have the 'atan2pi' function. */
-#undef HAVE_ATAN2PI
-
 /* Define to 1 if you have the 'atanh' function. */
 #undef HAVE_ATANH
 
-/* Define to 1 if you have the 'atanpi' function. */
-#undef HAVE_ATANPI
-
 /* Define to 1 if you have the 'backtrace' function. */
 #undef HAVE_BACKTRACE
 
@@ -191,9 +179,6 @@
 /* Define to 1 if you have the 'copy_file_range' function. */
 #undef HAVE_COPY_FILE_RANGE
 
-/* Define to 1 if you have the 'cospi' function. */
-#undef HAVE_COSPI
-
 /* Define to 1 if you have the 'ctermid' function. */
 #undef HAVE_CTERMID
 
@@ -1381,9 +1366,6 @@
 /* Define to 1 if you have the 'sigwaitinfo' function. */
 #undef HAVE_SIGWAITINFO
 
-/* Define to 1 if you have the 'sinpi' function. */
-#undef HAVE_SINPI
-
 /* Define to 1 if you have the 'snprintf' function. */
 #undef HAVE_SNPRINTF
 
@@ -1662,9 +1644,6 @@
 /* Define to 1 if you have the <sys/xattr.h> header file. */
 #undef HAVE_SYS_XATTR_H
 
-/* Define to 1 if you have the 'tanpi' function. */
-#undef HAVE_TANPI
-
 /* Define to 1 if you have the 'tcgetpgrp' function. */
 #undef HAVE_TCGETPGRP
 
@@ -2200,6 +2179,21 @@
 /* HACL* library can compile SIMD256 implementations */
 #undef _Py_HACL_CAN_COMPILE_VEC256
 
+/* Define if you have the 'acospi' function. */
+#undef _Py_HAVE_ACOSPI
+
+/* Define if you have the 'asinpi' function. */
+#undef _Py_HAVE_ASINPI
+
+/* Define if you have the 'atan2pi' function. */
+#undef _Py_HAVE_ATAN2PI
+
+/* Define if you have the 'atanpi' function. */
+#undef _Py_HAVE_ATANPI
+
+/* Define if you have the 'cospi' function. */
+#undef _Py_HAVE_COSPI
+
 /* Define if compiler supports __builtin_shufflevector with 128-bit vectors
    AND the target architecture has native SIMD (not just API availability) */
 #undef _Py_HAVE_EFFICIENT_BUILTIN_SHUFFLEVECTOR
@@ -2217,6 +2211,12 @@
 /* Define if you have the 'PR_SET_VMA_ANON_NAME' constant. */
 #undef _Py_HAVE_PR_SET_VMA_ANON_NAME
 
+/* Define if you have the 'sinpi' function. */
+#undef _Py_HAVE_SINPI
+
+/* Define if you have the 'tanpi' function. */
+#undef _Py_HAVE_TANPI
+
 /* Thread stack size set by the linker (in bytes). */
 #undef _Py_LINKER_THREAD_STACK_SIZE
 

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to