GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — gh-145410: Use _sysconfig.get_platform() in the platform module by vstinner · Pull Request #146148 · python/cpython Conversation
|
|
The change avoids the WMI query ( cc @zooba |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
This looks fine, but can we be sure that the output does not change across supported Windows platforms ? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
According to #98962 (comment) comment, |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
cc @diegorusso |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I'm OK with the changes, just a minor comment on win-arm32 (that in my opinion we shouldn't need)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| # platform: (arch, bits, linkage) | ||
| 'win32': ('x86', '32bit', 'WindowsPE'), | ||
| 'win-amd64': ('AMD64', '64bit', 'WindowsPE'), | ||
| 'win-arm32': ('ARM', '32bit', 'WindowsPE'), |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Do we really care about Windows on Arm 32bit? This is specifically Windows RT 8.1 which ended support in 2023.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
From https://learn.microsoft.com/en-us/windows/arm/arm32-to-arm64
Windows devices running on an Arm processor (...) no longer support AArch32 (Arm32). This change impacts Universal Windows Platform apps that presently target AArch32 (Arm32). Support for 32-bit Arm versions of applications is removed in a future release of Windows 11.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Until all support is entirely ripped out, it's still possible for someone to compile it. So we don't need it, but if someone out there needs it, we may as well leave it in until we're actively trying to prevent them doing their job (which, as a general rule, we don't do).
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Actually while we are here, we should update the documentation as well (if it is found to be inconsistent)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
The platform module is meant for inspecting the platform Python runs on, sysconfig normally refers to the platform and settings it was compiled with. As for return values, "win-arm64" is not an architecture. The "win-" part refers to the OS. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I've just realised that I approved the PR but I didn't mean to :)
I'm not sure If I can un-approve it, hence requesting a change.
My comments still stand.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
When you're done making the requested changes, leave the comment: |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| # Use _sysconfig.get_platform() if available | ||
| arch, bits, linkage = _sysconfig_platform() | ||
| if arch: | ||
| return arch |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
We can't do this, because the current CPU can be different from the Python runtime. We have to query the OS specifically, we can't rely on compile-time.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| if not fileout and \ | ||
| executable == sys.executable: | ||
| if not fileout and executable == sys.executable: |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This is the necessary condition for using _sysconfig.get_platform() - no change required, just pointing out why it's okay to assume that sys.executable is us.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Yeah, I understood that when reading #98962 after I wrote my PR. I prefer to close my PR, since it would return the wrong platform in some cases. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.