From e1011ecad64bc6aef225cf4fca6f97ed6ce506d6 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Fri, 19 Apr 2024 08:38:50 +0800 Subject: [PATCH 1/2] Modify preprocessor symbol usage to support older macOS SDKs. --- Misc/platform_triplet.c | 8 +++++--- Modules/_testexternalinspection.c | 4 ++++ Python/marshal.c | 3 ++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Misc/platform_triplet.c b/Misc/platform_triplet.c index 06b03bfa9a266a..ec0857a4a998c0 100644 --- a/Misc/platform_triplet.c +++ b/Misc/platform_triplet.c @@ -246,8 +246,9 @@ PLATFORM_TRIPLET=i386-gnu # endif #elif defined(__APPLE__) # include "TargetConditionals.h" -# if TARGET_OS_IOS -# if TARGET_OS_SIMULATOR +// Older macOS SDKs do not define TARGET_OS_* +# if defined(TARGET_OS_IOS) && TARGET_OS_IOS +# if defined(TARGET_OS_SIMULATOR) && TARGET_OS_SIMULATOR # if __x86_64__ PLATFORM_TRIPLET=x86_64-iphonesimulator # else @@ -256,7 +257,8 @@ PLATFORM_TRIPLET=arm64-iphonesimulator # else PLATFORM_TRIPLET=arm64-iphoneos # endif -# elif TARGET_OS_OSX +// Older macOS SDKs do not define TARGET_OS_OSX +# elif !defined(TARGET_OS_OSX) || TARGET_OS_OSX PLATFORM_TRIPLET=darwin # else # error unknown Apple platform diff --git a/Modules/_testexternalinspection.c b/Modules/_testexternalinspection.c index bd77f0cd0f1fc7..e2f96cdad5c58e 100644 --- a/Modules/_testexternalinspection.c +++ b/Modules/_testexternalinspection.c @@ -17,6 +17,10 @@ #if defined(__APPLE__) # include +// Older macOS SDKs do not define TARGET_OS_OSX +# if !defined(TARGET_OS_OSX) +# define TARGET_OS_OSX 1 +# endif # if TARGET_OS_OSX # include # include diff --git a/Python/marshal.c b/Python/marshal.c index 21d242bbb9757e..69119fc8641d54 100644 --- a/Python/marshal.c +++ b/Python/marshal.c @@ -41,7 +41,8 @@ module marshal #elif defined(__wasi__) # define MAX_MARSHAL_STACK_DEPTH 1500 // TARGET_OS_IPHONE covers any non-macOS Apple platform. -#elif defined(__APPLE__) && TARGET_OS_IPHONE +// It won't be defined on older macOS SDKs +#elif defined(__APPLE__) && defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE # define MAX_MARSHAL_STACK_DEPTH 1500 #else # define MAX_MARSHAL_STACK_DEPTH 2000 From 714585a2b390972069c3ac62b9c6fc69c4a29942 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Fri, 19 Apr 2024 08:40:08 +0800 Subject: [PATCH 2/2] Add changenote. --- .../next/macOS/2024-04-19-08-40-00.gh-issue-114099._iDfrQ.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/macOS/2024-04-19-08-40-00.gh-issue-114099._iDfrQ.rst diff --git a/Misc/NEWS.d/next/macOS/2024-04-19-08-40-00.gh-issue-114099._iDfrQ.rst b/Misc/NEWS.d/next/macOS/2024-04-19-08-40-00.gh-issue-114099._iDfrQ.rst new file mode 100644 index 00000000000000..f9af0629ed9434 --- /dev/null +++ b/Misc/NEWS.d/next/macOS/2024-04-19-08-40-00.gh-issue-114099._iDfrQ.rst @@ -0,0 +1 @@ +iOS preprocessor symbol usage was made compatible with older macOS SDKs.