]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-61103: drop unused Py_HAVE_C_COMPLEX define (GH-133435)
authorSergey B Kirpichev <skirpichev@gmail.com>
Mon, 5 May 2025 13:50:57 +0000 (16:50 +0300)
committerGitHub <noreply@github.com>
Mon, 5 May 2025 13:50:57 +0000 (15:50 +0200)
Py_HAVE_C_COMPLEX was added in 3.14 so the removal doesn't need a deprecation
period even under a strict reading of PEP 387.

The Py_FFI_SUPPORT_C_COMPLEX check configure check implies support for
complex types in ctypes.

Modules/_ctypes/_ctypes_test.c
configure
configure.ac
pyconfig.h.in

index 557bfa85b1ea29c8d16fb6de0e39c51f0607d8b4..d28e5708b4493306133c5b0dac402f1cdac95461 100644 (file)
@@ -23,7 +23,7 @@
 #  define _Py_thread_local __thread
 #endif
 
-#if defined(Py_HAVE_C_COMPLEX) && 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_HAVE_C_COMPLEX) && defined(Py_FFI_SUPPORT_C_COMPLEX)
+#if defined(Py_FFI_SUPPORT_C_COMPLEX)
 EXPORT(double complex) my_csqrt(double complex a)
 {
     return csqrt(a);
index 1f425c02a55156ee1dbd7b26d6433a145df929ca..a1069509406a34501c4d36cee88724df896138e0 100755 (executable)
--- a/configure
+++ b/configure
@@ -14654,53 +14654,6 @@ printf "%s\n" "$AIX_BUILDDATE" >&6; }
        *) ;;
 esac
 
-# check for _Complex C type
-#
-# Note that despite most compilers define __STDC_IEC_559_COMPLEX__ - almost
-# none properly support C11+ Annex G (where pure imaginary types
-# represented by _Imaginary are mandatory).  This is a bug (see e.g.
-# llvm/llvm-project#60269), so we don't rely on presence
-# of __STDC_IEC_559_COMPLEX__.
-if test "$cross_compiling" = yes
-then :
-  ac_cv_c_complex_supported=no
-else case e in #(
-  e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-#include <complex.h>
-#define test(type, out)                                \
-{                                                      \
-    type complex z = 1 + 2*I; z = z*z;                 \
-    (out) = (out) || creal(z) != -3 || cimag(z) != 4;  \
-}
-int main(void)
-{
-   int res = 0;
-   test(float, res);
-   test(double, res);
-   test(long double, res);
-   return res;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"
-then :
-  ac_cv_c_complex_supported=yes
-else case e in #(
-  e) ac_cv_c_complex_supported=no ;;
-esac
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext ;;
-esac
-fi
-
-if test "$ac_cv_c_complex_supported" = "yes"; then
-
-printf "%s\n" "#define Py_HAVE_C_COMPLEX 1" >>confdefs.h
-
-fi
-
 # check for systems that require aligned memory access
 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking aligned memory access is required" >&5
 printf %s "checking aligned memory access is required... " >&6; }
index 96b157a13e88db951260011a36af0ba4d800df85..4efd0328691d19edf7210bc842e38d8de73142ac 100644 (file)
@@ -3838,35 +3838,6 @@ dnl The AIX_BUILDDATE is obtained from the kernel fileset - bos.mp64
        *) ;;
 esac
 
-# check for _Complex C type
-#
-# Note that despite most compilers define __STDC_IEC_559_COMPLEX__ - almost
-# none properly support C11+ Annex G (where pure imaginary types
-# represented by _Imaginary are mandatory).  This is a bug (see e.g.
-# llvm/llvm-project#60269), so we don't rely on presence
-# of __STDC_IEC_559_COMPLEX__.
-AC_RUN_IFELSE([AC_LANG_SOURCE([[
-#include <complex.h>
-#define test(type, out)                                \
-{                                                      \
-    type complex z = 1 + 2*I; z = z*z;                 \
-    (out) = (out) || creal(z) != -3 || cimag(z) != 4;  \
-}
-int main(void)
-{
-   int res = 0;
-   test(float, res);
-   test(double, res);
-   test(long double, res);
-   return res;
-}]])], [ac_cv_c_complex_supported=yes],
-[ac_cv_c_complex_supported=no],
-[ac_cv_c_complex_supported=no])
-if test "$ac_cv_c_complex_supported" = "yes"; then
-    AC_DEFINE([Py_HAVE_C_COMPLEX], [1],
-              [Defined if _Complex C type is available.])
-fi
-
 # check for systems that require aligned memory access
 AC_CACHE_CHECK([aligned memory access is required], [ac_cv_aligned_required],
 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
index 8c2c6ab5cea4cdd4434a87af10b3bcda7697f26c..c91facbedf94e5ab3bcae63ca9f73bee35adfeb8 100644 (file)
    SipHash13: 3, externally defined: 0 */
 #undef Py_HASH_ALGORITHM
 
-/* Defined if _Complex C type is available. */
-#undef Py_HAVE_C_COMPLEX
-
 /* Define if year with century should be normalized for strftime. */
 #undef Py_NORMALIZE_CENTURY