Skip to content
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-114490: Add check for Mach-O linkage in Lib/platform.py #114491

Merged
merged 7 commits into from Jan 26, 2024

Conversation

aidenfoxivey
Copy link
Contributor

@aidenfoxivey aidenfoxivey commented Jan 23, 2024

Copy link

cpython-cla-bot bot commented Jan 23, 2024

All commit authors signed the Contributor License Agreement.
CLA signed

@bedevere-app
Copy link

bedevere-app bot commented Jan 23, 2024

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
Contributor Author

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

Copy link
Contributor

@ronaldoussoren ronaldoussoren left a comment

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
Copy link

bedevere-app bot commented Jan 23, 2024

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
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
Contributor 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
Contributor 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
Contributor Author

I have made the requested changes; please review again

@ronaldoussoren
Copy link
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.

Copy link
Contributor

@ronaldoussoren ronaldoussoren left a comment

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.

@aidenfoxivey
Copy link
Contributor Author

I have made the requested changes; please review again

…OQ0.rst

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

@ronaldoussoren ronaldoussoren left a comment

Choose a reason for hiding this comment

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

LGTM

@ronaldoussoren ronaldoussoren merged commit b5c7c84 into python:main Jan 26, 2024
30 of 31 checks passed
@ronaldoussoren
Copy link
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>
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.

None yet

3 participants