Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.1k
gh-131591: Handle includes for iOS in remote_debugging.c#132050
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
@freakboy3742 can you advise if this is the best way to handle this? The error was:
|
!buildbot simulator |
bedevere-bot commentedApr 3, 2025
🤖 New build scheduled with the buildbot fleet by@pablogsal for commit3ec2116 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F132050%2Fmerge The command will test the builders whose names match following regular expression: The builders matched are:
|
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
!buildbot simulator |
bedevere-bot commentedApr 3, 2025
🤖 New build scheduled with the buildbot fleet by@pablogsal for commit1e29ec6 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F132050%2Fmerge The command will test the builders whose names match following regular expression: The builders matched are:
|
Uh oh!
There was an error while loading.Please reload this page.
#if defined(__APPLE__) && TARGET_OS_OSX | ||
# include <libproc.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This will break on older macOS versions (essentially any macOS version that predates the existence of iPhone) becauseTARGET_OS_OSX
doesn't exist. However, on all versions of iOS,TARGET_OS_OSX
willexist with a value of 0. So - my suggested approach here would be:
#if defined(__APPLE__)&&TARGET_OS_OSX | |
# include<libproc.h> | |
#if defined(__APPLE__) | |
# include<TargetConditionals.h> | |
# if !defined(TARGET_OS_OSX)||TARGET_OS_OSX |
I can see there's a couple of other places (L99 of this file; L352 of pycore_eval.h) where an analogous change would be required.
I guess the other option would be to modify the code that setsTARGET_OS_OSX
from:
# if !defined(TARGET_OS_OSX) # define TARGET_OS_OSX 1 # endif
to
# if !defined(TARGET_OS_OSX) && !(defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE)# define TARGET_OS_OSX 1# endif
This works becauseTARGET_OS_IPHONE
isany Apple mobile device (iOS, tvOS, watchOS, visionOS);TARGET_OS_IOS
is specifically an iPhone/iPad. However, futzing withTARGET_OS_OSX
seems like asking for trouble, so the explicit approach would be my preferred option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I think you may be missing the context that this file is importing this header where we are doing the dance:
cpython/Include/internal/pycore_ceval.h
Lines 350 to 360 in0dbaeb9
#ifndefPy_SUPPORTS_REMOTE_DEBUG | |
#if defined(__APPLE__) | |
# if !defined(TARGET_OS_OSX) | |
// Older macOS SDKs do not define TARGET_OS_OSX | |
# defineTARGET_OS_OSX 1 | |
# endif | |
#endif | |
#if ((defined(__APPLE__)&&TARGET_OS_OSX)|| defined(MS_WINDOWS)|| (defined(__linux__)&&HAVE_PROCESS_VM_READV)) | |
# definePy_SUPPORTS_REMOTE_DEBUG 1 | |
#endif | |
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Yes - I did miss that import would be in effect. Given that imported definition, the form you've got in the PR at present shouldwork - but it still makes me a bit twitchy because it's redefining an Apple-provided constant that has otherwise well defined behavior.
This is essentially what bit me here - the logic didn't make sense because I didn't notice the import where the behavior of the Apple-provided constant was being redefined). We've also had examples in the past where someone adds/removes an import of an otherwise unrelated file, and suddenly things break because that file has redefined basic platform constants (or has removed an import that was making those constants work in a predictable way).
If we're going to go down the path of redefining the constant, it might be worth looking at a top-level replacement forTargetConditionals.h
that uses those base definitions and ensures they're consistently defined (so we don't need to do thedefined(TARGET_OS_OSX) && TARGET_OS_OSX
dance everywhere) - but that's a much bigger set of changes, and then comes with the overhead of making sure that everyone remembers touse the updated definitions, rather than importingTargetConditionals.h
.
So - call my preference for using the definitions-as-provided a "strong opinion, weakly held". With the indentation nitpick flagged inpycore_ceval.h
, I can live with this as-is.
When you're done making the requested changes, leave the comment: |
Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
@freakboy3742 If you prefer we can use the |
... huh. Well now I've beenhoist with my own petard. I've gone on a bit of a code dive to see how big a change reverting So - lets go with the redefine-based approach you've got here. |
2067378
intopython:mainUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.