https://github.com/python/cpython/commit/1d0f1ad0aa7a933e8d03f855d9b5eed7e00e775d
commit: 1d0f1ad0aa7a933e8d03f855d9b5eed7e00e775d
branch: main
author: Victor Stinner <[email protected]>
committer: vstinner <[email protected]>
date: 2026-09-19T10:34:26+02:00
summary:

gh-157695: Rename HAVE_FLOAT16 macro to _Py_HAVE_FLOAT16 (#157752)

files:
M Objects/floatobject.c
M configure
M configure.ac
M pyconfig.h.in

diff --git a/Objects/floatobject.c b/Objects/floatobject.c
index e379770e10031d..1bb5311ac678a5 100644
--- a/Objects/floatobject.c
+++ b/Objects/floatobject.c
@@ -1895,7 +1895,7 @@ int
 PyFloat_Pack2(double x, char *data, int le)
 {
     unsigned char *p = (unsigned char *)data;
-#if HAVE_FLOAT16
+#if _Py_HAVE_FLOAT16
     /* Conversion can change NaNs type or alter payload.  Here we
        just fallback to the generic code, instead of providing
        workarounds as for single/double precision. */
@@ -2115,7 +2115,7 @@ double
 PyFloat_Unpack2(const char *data, int le)
 {
     unsigned char *p = (unsigned char *)data;
-#if HAVE_FLOAT16
+#if _Py_HAVE_FLOAT16
     _Float16 x16;
 
     if ((_PY_FLOAT_LITTLE_ENDIAN && !le) || (_PY_FLOAT_BIG_ENDIAN && le)) {
diff --git a/configure b/configure
index 1115be256afb49..9af81bf7cc67d1 100755
--- a/configure
+++ b/configure
@@ -16780,7 +16780,7 @@ printf "%s\n" "$ac_cv_float16_supported" >&6; }
 if test "x$ac_cv_float16_supported" = xyes
 then :
 
-printf "%s\n" "#define HAVE_FLOAT16 1" >>confdefs.h
+printf "%s\n" "#define _Py_HAVE_FLOAT16 1" >>confdefs.h
 
 fi
 
diff --git a/configure.ac b/configure.ac
index 902a822e43a42f..92d7c17a6b448b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4486,7 +4486,7 @@ int main(void)
 [ac_cv_float16_supported=no],
 [ac_cv_float16_supported=no])]))
 AS_VAR_IF([ac_cv_float16_supported], [yes],
-          [AC_DEFINE([HAVE_FLOAT16], [1],
+          [AC_DEFINE([_Py_HAVE_FLOAT16], [1],
                      [Defined if _Float16 C type is supported])])
 
 dnl Check for libmpdec >= 2.5.0
diff --git a/pyconfig.h.in b/pyconfig.h.in
index e798a061ab6d09..2bf45a290a4ed1 100644
--- a/pyconfig.h.in
+++ b/pyconfig.h.in
@@ -497,9 +497,6 @@
 /* Define if you have the 'ffi_prep_closure_loc' function. */
 #undef HAVE_FFI_PREP_CLOSURE_LOC
 
-/* Defined if _Float16 C type is supported */
-#undef HAVE_FLOAT16
-
 /* Define to 1 if you have the 'flock' function. */
 #undef HAVE_FLOCK
 
@@ -2210,6 +2207,9 @@
    AND the target architecture has native SIMD (not just API availability) */
 #undef _Py_HAVE_EFFICIENT_BUILTIN_SHUFFLEVECTOR
 
+/* Defined if _Float16 C type is supported */
+#undef _Py_HAVE_FLOAT16
+
 /* Define to 1 if libgcc __register_frame and __deregister_frame are linkable.
    */
 #undef _Py_HAVE_LIBGCC_EH_FRAME_REGISTRATION

_______________________________________________
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