Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged
pablogsal merged 2 commits intopython:mainfrompablogsal:gh-131591-2
Apr 6, 2025

Conversation

pablogsal
Copy link
Member

@pablogsalpablogsal commentedApr 3, 2025
edited by bedevere-appbot
Loading

@pablogsal
Copy link
MemberAuthor

@freakboy3742 can you advise if this is the best way to handle this? The error was:

HEAD is now at 943cc1431eb gh-131591: Implement PEP 768 (#131937)Switched to and reset branch 'main'configure: WARNING: no system libmpdecimal found; falling back to bundled libmpdecimal (deprecated and scheduled for removal in Python 3.15)configure: WARNING: pkg-config is missing. Some dependencies may not be detected correctly.configure: WARNING: no system libmpdecimal found; falling back to bundled libmpdecimal (deprecated and scheduled for removal in Python 3.15)configure: WARNING: pkg-config is missing. Some dependencies may not be detected correctly.../../Python/remote_debugging.c:30:14: fatal error: 'libproc.h' file not found   30 | #    include <libproc.h>      |              ^~~~~~~~~~~1 error generated.make: *** [Python/remote_debugging.o] Error 1find: build: No such file or directoryfind: build: No such file or directoryfind: build: No such file or directoryfind: build: No such file or directorymake: [clean-retain-profile] Error 1 (ignored)

@pablogsal
Copy link
MemberAuthor

!buildbot simulator

@bedevere-bot
Copy link

🤖 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:simulator

The builders matched are:

  • iOS ARM64 Simulator PR

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
@pablogsal
Copy link
MemberAuthor

!buildbot simulator

@bedevere-bot
Copy link

🤖 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:simulator

The builders matched are:

  • iOS ARM64 Simulator PR

Comment on lines +23 to +24
#if defined(__APPLE__) && TARGET_OS_OSX
# include <libproc.h>
Copy link
Contributor

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:

Suggested change
#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.

Copy link
MemberAuthor

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:

#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

Copy link
Contributor

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.

@bedevere-app
Copy link

When you're done making the requested changes, leave the comment:I have made the requested changes; please review again.

Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
@pablogsal
Copy link
MemberAuthor

@freakboy3742 If you prefer we can use theif !defined(TARGET_OS_OSX) && !(defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) version. Would you prefer that instead of the current approach? I selected this based on your code in_testexternalinspection.c

@freakboy3742
Copy link
Contributor

I selected this based on your code in_testexternalinspection.c

... 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#define TARGET_OS_OSX 1 would be, and the more I look, the more the "redefining" approach seems the pragmatic choice. There's lots of "bare" uses ofTARGET_OS_OSX that are already impacted by the existing definitions, and none of those are made easier to read by requiring an explicitdefined(TARGET_OS_OSX) as a prefix. And, if someone forgets that thedefined(TARGET_OS_OSX) is required, that's an automatic breakage for old macOS versions - so having the redefine in place is a good safety catch.

So - lets go with the redefine-based approach you've got here.

@python-cla-bot
Copy link

All commit authors signed the Contributor License Agreement.

CLA signed

@pablogsalpablogsal merged commit2067378 intopython:mainApr 6, 2025
41 checks passed
@pablogsalpablogsal deleted the gh-131591-2 branchApril 6, 2025 20:39
seehwan pushed a commit to seehwan/cpython that referenced this pull requestApr 16, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@freakboy3742freakboy3742freakboy3742 approved these changes

Assignees
No one assigned
Labels
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@pablogsal@bedevere-bot@freakboy3742

[8]ページ先頭

©2009-2025 Movatter.jp