https://github.com/python/cpython/commit/1bc16504ef3866cc419f3781eef6528b93aee6b4
commit: 1bc16504ef3866cc419f3781eef6528b93aee6b4
branch: main
author: Sergey B Kirpichev <[email protected]>
committer: encukou <[email protected]>
date: 2025-05-05T15:50:57+02:00
summary:
gh-61103: drop unused Py_HAVE_C_COMPLEX define (GH-133435)
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.
files:
M Modules/_ctypes/_ctypes_test.c
M configure
M configure.ac
M pyconfig.h.in
diff --git a/Modules/_ctypes/_ctypes_test.c b/Modules/_ctypes/_ctypes_test.c
index 557bfa85b1ea29..d28e5708b44933 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_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);
diff --git a/configure b/configure
index 1f425c02a55156..a1069509406a34 100755
--- 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; }
diff --git a/configure.ac b/configure.ac
index 96b157a13e88db..4efd0328691d19 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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([[
diff --git a/pyconfig.h.in b/pyconfig.h.in
index 8c2c6ab5cea4cd..c91facbedf94e5 100644
--- a/pyconfig.h.in
+++ b/pyconfig.h.in
@@ -1730,9 +1730,6 @@
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
_______________________________________________
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]