https://github.com/python/cpython/commit/9193efdeab4596f987528ba278afa2eca93a9e8a
commit: 9193efdeab4596f987528ba278afa2eca93a9e8a
branch: main
author: Petr Viktorin <[email protected]>
committer: encukou <[email protected]>
date: 2025-06-26T11:48:37+02:00
summary:
gh-125206: Make _Py_FFI_SUPPORT_C_COMPLEX private (GH-135932)
files:
M Modules/_ctypes/_ctypes_test.c
M Modules/_ctypes/cfield.c
M Modules/_ctypes/ctypes.h
M configure
M configure.ac
M pyconfig.h.in
diff --git a/Modules/_ctypes/_ctypes_test.c b/Modules/_ctypes/_ctypes_test.c
index d28e5708b44933..66338805007853 100644
--- a/Modules/_ctypes/_ctypes_test.c
+++ b/Modules/_ctypes/_ctypes_test.c
@@ -23,7 +23,7 @@
# define _Py_thread_local __thread
#endif
-#if defined(Py_FFI_SUPPORT_C_COMPLEX)
+#if defined(_Py_FFI_SUPPORT_C_COMPLEX)
# include <complex.h> // csqrt()
# undef I // for _ctypes_test_generated.c.h
#endif
@@ -457,7 +457,7 @@ EXPORT(double) my_sqrt(double a)
return sqrt(a);
}
-#if defined(Py_FFI_SUPPORT_C_COMPLEX)
+#if defined(_Py_FFI_SUPPORT_C_COMPLEX)
EXPORT(double complex) my_csqrt(double complex a)
{
return csqrt(a);
diff --git a/Modules/_ctypes/cfield.c b/Modules/_ctypes/cfield.c
index 163b92642615e5..547e2471a1cbc0 100644
--- a/Modules/_ctypes/cfield.c
+++ b/Modules/_ctypes/cfield.c
@@ -759,7 +759,7 @@ d_get(void *ptr, Py_ssize_t size)
return PyFloat_FromDouble(val);
}
-#if defined(Py_FFI_SUPPORT_C_COMPLEX)
+#if defined(_Py_FFI_SUPPORT_C_COMPLEX)
/* We don't use _Complex types here, using arrays instead, as the C11+
standard says: "Each complex type has the same representation and alignment
@@ -1599,7 +1599,7 @@ for base_code, base_c_type in [
///////////////////////////////////////////////////////////////////////////
TABLE_ENTRY_SW(d, &ffi_type_double);
-#if defined(Py_FFI_SUPPORT_C_COMPLEX)
+#if defined(_Py_FFI_SUPPORT_C_COMPLEX)
if (Py_FFI_COMPLEX_AVAILABLE) {
TABLE_ENTRY(D, &ffi_type_complex_double);
TABLE_ENTRY(F, &ffi_type_complex_float);
diff --git a/Modules/_ctypes/ctypes.h b/Modules/_ctypes/ctypes.h
index 6a45c11e61af5c..5b4f97d43b8721 100644
--- a/Modules/_ctypes/ctypes.h
+++ b/Modules/_ctypes/ctypes.h
@@ -23,7 +23,7 @@
// Do we support C99 complex types in ffi?
// For Apple's libffi, this must be determined at runtime (see gh-128156).
-#if defined(Py_FFI_SUPPORT_C_COMPLEX)
+#if defined(_Py_FFI_SUPPORT_C_COMPLEX)
# if USING_APPLE_OS_LIBFFI && defined(__has_builtin)
# if __has_builtin(__builtin_available)
# define Py_FFI_COMPLEX_AVAILABLE __builtin_available(macOS 10.15, *)
diff --git a/configure b/configure
index 50223d81cd976e..43b36d9231e341 100755
--- a/configure
+++ b/configure
@@ -15742,7 +15742,7 @@ fi
printf "%s\n" "$ac_cv_ffi_complex_double_supported" >&6; }
if test "$ac_cv_ffi_complex_double_supported" = "yes"; then
-printf "%s\n" "#define Py_FFI_SUPPORT_C_COMPLEX 1" >>confdefs.h
+printf "%s\n" "#define _Py_FFI_SUPPORT_C_COMPLEX 1" >>confdefs.h
fi
diff --git a/configure.ac b/configure.ac
index f58e16c774f4aa..e77696e3a4e025 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4163,7 +4163,7 @@ int main(void)
[ac_cv_ffi_complex_double_supported=no])
])])
if test "$ac_cv_ffi_complex_double_supported" = "yes"; then
- AC_DEFINE([Py_FFI_SUPPORT_C_COMPLEX], [1],
+ AC_DEFINE([_Py_FFI_SUPPORT_C_COMPLEX], [1],
[Defined if _Complex C type can be used with libffi.])
fi
diff --git a/pyconfig.h.in b/pyconfig.h.in
index 65a2c55217c258..d4f1da7fb10776 100644
--- a/pyconfig.h.in
+++ b/pyconfig.h.in
@@ -1736,9 +1736,6 @@
/* Defined if Python is built as a shared library. */
#undef Py_ENABLE_SHARED
-/* Defined if _Complex C type can be used with libffi. */
-#undef Py_FFI_SUPPORT_C_COMPLEX
-
/* Define if you want to disable the GIL */
#undef Py_GIL_DISABLED
@@ -2026,6 +2023,9 @@
/* Maximum length in bytes of a thread name */
#undef _PYTHREAD_NAME_MAXLEN
+/* Defined if _Complex C type can be used with libffi. */
+#undef _Py_FFI_SUPPORT_C_COMPLEX
+
/* Define to force use of thread-safe errno, h_errno, and other functions */
#undef _REENTRANT
_______________________________________________
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]