-
-
Notifications
You must be signed in to change notification settings - Fork 31.5k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh-131591: Handle includes for iOS in remote_debugging.c #132050
Merged
+14
−20
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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) because
TARGET_OS_OSX
doesn't exist. However, on all versions of iOS,TARGET_OS_OSX
will exist with a value of 0. So - my suggested approach here would be: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 sets
TARGET_OS_OSX
from:to
This works because
TARGET_OS_IPHONE
is any 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 in 0dbaeb9
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 should work - 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 for
TargetConditionals.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 to use 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 in
pycore_ceval.h
, I can live with this as-is.