From 1e29ec6a06ed14294e39f71fdeb09bb9e757351f Mon Sep 17 00:00:00 2001 From: Pablo Galindo Date: Thu, 3 Apr 2025 16:28:28 +0100 Subject: [PATCH 1/2] gh-131591: Handle includes for iOS in remote_debugging.c Signed-off-by: Pablo Galindo --- Include/internal/pycore_ceval.h | 1 + Python/remote_debugging.c | 33 +++++++++++++-------------------- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/Include/internal/pycore_ceval.h b/Include/internal/pycore_ceval.h index 044403a6548b50..4dced63291f93e 100644 --- a/Include/internal/pycore_ceval.h +++ b/Include/internal/pycore_ceval.h @@ -349,6 +349,7 @@ PyAPI_FUNC(_PyStackRef) _PyFloat_FromDouble_ConsumeInputs(_PyStackRef left, _PyS #ifndef Py_SUPPORTS_REMOTE_DEBUG #if defined(__APPLE__) +#include # if !defined(TARGET_OS_OSX) // Older macOS SDKs do not define TARGET_OS_OSX # define TARGET_OS_OSX 1 diff --git a/Python/remote_debugging.c b/Python/remote_debugging.c index 9b2297b5627aa3..1b7311f0ce897b 100644 --- a/Python/remote_debugging.c +++ b/Python/remote_debugging.c @@ -20,24 +20,17 @@ # include #endif -#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 -# include -# include -# include -# include -# include -# include -# include -# include -# endif +#if defined(__APPLE__) && TARGET_OS_OSX +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include #endif #ifdef MS_WINDOWS @@ -65,6 +58,8 @@ # define HAVE_PROCESS_VM_READV 0 #endif +#if defined(Py_REMOTE_DEBUG) && defined(Py_SUPPORTS_REMOTE_DEBUG) + // Define a platform-independent process handle structure typedef struct { pid_t pid; @@ -101,8 +96,6 @@ cleanup_proc_handle(proc_handle_t *handle) { handle->pid = 0; } -#if defined(Py_REMOTE_DEBUG) && defined(Py_SUPPORTS_REMOTE_DEBUG) - #if defined(__APPLE__) && TARGET_OS_OSX static uintptr_t return_section_address( From 37f90b612aa52c1b0a1a33739d01e988ff1ceafe Mon Sep 17 00:00:00 2001 From: Pablo Galindo Salgado Date: Fri, 4 Apr 2025 15:34:17 +0100 Subject: [PATCH 2/2] Update Include/internal/pycore_ceval.h Co-authored-by: Russell Keith-Magee --- Include/internal/pycore_ceval.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Include/internal/pycore_ceval.h b/Include/internal/pycore_ceval.h index 4dced63291f93e..b229c7d37fc4c3 100644 --- a/Include/internal/pycore_ceval.h +++ b/Include/internal/pycore_ceval.h @@ -349,7 +349,7 @@ PyAPI_FUNC(_PyStackRef) _PyFloat_FromDouble_ConsumeInputs(_PyStackRef left, _PyS #ifndef Py_SUPPORTS_REMOTE_DEBUG #if defined(__APPLE__) -#include + #include # if !defined(TARGET_OS_OSX) // Older macOS SDKs do not define TARGET_OS_OSX # define TARGET_OS_OSX 1