Skip to content

gh-114490: Add check for Mach-O linkage in Lib/platform.py#114491

Merged
ronaldoussoren merged 7 commits into
python:mainfrom
aidenfoxivey:fix-issue-114490
Jan 26, 2024
Merged

gh-114490: Add check for Mach-O linkage in Lib/platform.py#114491
ronaldoussoren merged 7 commits into
python:mainfrom
aidenfoxivey:fix-issue-114490

Conversation

@aidenfoxivey

@aidenfoxivey aidenfoxivey commented Jan 23, 2024

Copy link
Copy Markdown

@ghost

ghost commented Jan 23, 2024

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.
CLA signed

@bedevere-app

bedevere-app Bot commented Jan 23, 2024

Copy link
Copy Markdown

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@aidenfoxivey

Copy link
Copy Markdown
Author

Could be wrong here, but this seems like a minor enough change that no news is needed.

@ronaldoussoren ronaldoussoren left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change itself LGTM.

I would prefer a news entry though, adding it is easy enough and does show users that something changed here.

@bedevere-app

bedevere-app Bot commented Jan 23, 2024

Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@ronaldoussoren

Copy link
Copy Markdown
Contributor

BTW. Normally I'd ask for a test as well, but this function is mostly untested at the moment and adding a test for just the linkage on macOS feels wrong to me.

@aidenfoxivey

Copy link
Copy Markdown
Author

The change itself LGTM.

I would prefer a news entry though, adding it is easy enough and does show users that something changed here.

Sounds good! I'll set it right up.

@aidenfoxivey

Copy link
Copy Markdown
Author

BTW. Normally I'd ask for a test as well, but this function is mostly untested at the moment and adding a test for just the linkage on macOS feels wrong to me.

Oh, so it would be helpful to add some tests for this function?

@aidenfoxivey

Copy link
Copy Markdown
Author

I have made the requested changes; please review again

@ronaldoussoren

Copy link
Copy Markdown
Contributor

BTW. Normally I'd ask for a test as well, but this function is mostly untested at the moment and adding a test for just the linkage on macOS feels wrong to me.

Oh, so it would be helpful to add some tests for this function?

I'm personally not that bothered by not having tests for this function, but better test coverage can help avoiding regressions in the future.

AFAIK the only tests for this function are here:

def test_architecture(self):
res = platform.architecture()
@os_helper.skip_unless_symlink
@support.requires_subprocess()
def test_architecture_via_symlink(self): # issue3762
with support.PythonSymlink() as py:
cmd = "-c", "import platform; print(platform.architecture())"
self.assertEqual(py.call_real(*cmd), py.call_link(*cmd))

Tests will inherently have platform specifics in them, for other functions in platform the tests themselves are cross-platform by mocking functions used the test. For platform.architecture just mocking _syscmd_file should be good enough. This does require access to a number of platforms to collect data though.

@ronaldoussoren ronaldoussoren left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The linting job found a formatting niggle in the news entry, see the suggested change below.

With that change the PR is good to go.

Comment thread Misc/NEWS.d/next/macOS/2024-01-23-11-35-26.gh-issue-114490.FrQOQ0.rst Outdated
@aidenfoxivey

Copy link
Copy Markdown
Author

I have made the requested changes; please review again

Comment thread Misc/NEWS.d/next/macOS/2024-01-23-11-35-26.gh-issue-114490.FrQOQ0.rst Outdated
…OQ0.rst

Co-authored-by: AN Long <aisk@users.noreply.github.com>

@ronaldoussoren ronaldoussoren left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ronaldoussoren

Copy link
Copy Markdown
Contributor

@aidenfoxivey, thanks for your PR!

aisk added a commit to aisk/cpython that referenced this pull request Feb 11, 2024
…hon#114491)

``platform.architecture()`` now returns the format of binaries (e.g. Mach-O) instead of the default empty string.

Co-authored-by: AN Long <aisk@users.noreply.github.com>
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
…hon#114491)

``platform.architecture()`` now returns the format of binaries (e.g. Mach-O) instead of the default empty string.

Co-authored-by: AN Long <aisk@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants