| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
Looks good, but we need some feedback from MacOS experts.
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM. I verified that with the PR we could now build and install cpython on the current macOS 15.2 using MACOSX_DEPLOYMENT_TARGET=10.14 and then also install and execute the same binaries on a macOS 10.14.x system. As expected, on 15.2 the three complex types were available and on 10.14, they were not. And test_ctypes ran without errors on both systems. Nice work, @encukou !
Sorry, something went wrong.
|
Thank you for the thorough review! |
Sorry, something went wrong.
|
Not sure if it's my system or not but I'm unable to compile :( In file included from ./Modules/_ctypes/callproc.c:87:0:
./Modules/_ctypes/ctypes.h:12:72: error: missing binary operator before token "("
# if USING_APPLE_OS_LIBFFI && defined(__has_builtin) && __has_builtin(__builtin_available)
Other uses of __has_builtin are guarded by #if defined(__APPLE__): #if defined(__APPLE__) && defined(__has_builtin)
I'm using OpenSUSE and gcc 7.5 |
Sorry, something went wrong.
|
I think we should do the following: diff --git a/Modules/_ctypes/ctypes.h b/Modules/_ctypes/ctypes.h
index 1330754a7e0..dc079f2441b 100644
--- a/Modules/_ctypes/ctypes.h
+++ b/Modules/_ctypes/ctypes.h
@@ -9,8 +9,12 @@
// For Apple's libffi, this must be determined at runtime (see gh-128156).
#if defined(Py_HAVE_C_COMPLEX) && defined(Py_FFI_SUPPORT_C_COMPLEX)
# include "../_complex.h" // complex
-# if USING_APPLE_OS_LIBFFI && defined(__has_builtin) && __has_builtin(__builtin_available)
-# define Py_FFI_COMPLEX_AVAILABLE __builtin_available(macOS 10.15, *)
+# ifdef __has_builtin
+# if USING_APPLE_OS_LIBFFI && __has_builtin(__builtin_available)
+# define Py_FFI_COMPLEX_AVAILABLE __builtin_available(macOS 10.15, *)
+# else
+# define Py_FFI_COMPLEX_AVAILABLE 1
+# endif
# else
# define Py_FFI_COMPLEX_AVAILABLE 1
# endifThis is also what's recommended by https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005fbuiltin.html. |
Sorry, something went wrong.
|
Isn't `#if defined(__has_builtin)` equivalent to `#ifdef __has_builtin`?
|
Sorry, something went wrong.
|
Yes, but somehow this doesn't work so I don't know :( (I'll check tomorrow again but the current code doesn't compile on my side) |
Sorry, something went wrong.
|
I'd be interested to know what compiler, OS and configure settings you're using. |
Sorry, something went wrong.
|
I'm using gcc 7.5.0, my OS is openSUSE 15.5 and I used ./configure --with-pydebug. I can recheck tomorrow (I temporarily fixed this by defining __has_builtin). |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
formattable.fmt{C,E,F} now have a runtime guard (if USING_APPLE_OS_LIBFFI).
The list of type codes (previously SIMPLE_TYPE_CHARS) is now generated at runtime.
📚 Documentation preview 📚: https://cpython-previews--128680.org.readthedocs.build/