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.
This commit is contained in:
Sergey B Kirpichev 2025-05-05 16:50:57 +03:00 committed by GitHub
parent 59f78d7b06
commit 1bc16504ef
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 2 additions and 81 deletions

View 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);

47
configure generated vendored
View file

@ -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; }

View 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([[

View file

@ -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