Skip to content

Commit aa8c14a

Browse files
committed
Switch to Py_FFI_COMPLEX_AVAILABLE and tweak the comdition
1 parent e808ec2 commit aa8c14a

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Modules/_ctypes/cfield.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1436,7 +1436,7 @@ for base_code, base_c_type in [
14361436

14371437
TABLE_ENTRY_SW(d, &ffi_type_double);
14381438
#if defined(Py_HAVE_C_COMPLEX) && defined(Py_FFI_SUPPORT_C_COMPLEX)
1439-
if (have_ffi_complex()) {
1439+
if (Py_FFI_COMPLEX_AVAILABLE) {
14401440
TABLE_ENTRY(C, &ffi_type_complex_double);
14411441
TABLE_ENTRY(E, &ffi_type_complex_float);
14421442
TABLE_ENTRY(F, &ffi_type_complex_longdouble);

Modules/_ctypes/ctypes.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
// For Apple's libffi, this must be determined at runtime (see gh-128156).
1010
#if defined(Py_HAVE_C_COMPLEX) && defined(Py_FFI_SUPPORT_C_COMPLEX)
1111
# include "../_complex.h" // complex
12-
# if defined(__APPLE__) && USING_APPLE_OS_LIBFFI && defined(__has_builtin)
13-
# define have_ffi_complex() (__builtin_available(macOS 10.15, *))
12+
# if USING_APPLE_OS_LIBFFI && defined(__has_builtin) && __has_builtin(__builtin_available)
13+
# define Py_FFI_COMPLEX_AVAILABLE __builtin_available(macOS 10.15, *)
1414
# else
15-
# define have_ffi_complex() 1
15+
# define Py_FFI_COMPLEX_AVAILABLE 1
1616
# endif
1717
#else
18-
# define have_ffi_complex() 0
18+
# define Py_FFI_COMPLEX_AVAILABLE 0
1919
#endif
2020

2121
#ifndef MS_WIN32

0 commit comments

Comments
 (0)