| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
The change avoids the WMI query (SELECT Architecture FROM Win32_Processor) in platform.machine() for these 4 sysconfig platforms: win32, win-amd64, win-arm32 and win-arm64. cc @zooba |
Sorry, something went wrong.
Sorry, something went wrong.
|
This looks fine, but can we be sure that the output does not change across supported Windows platforms ? |
Sorry, something went wrong.
|
According to #98962 (comment) comment, platform.architecture() is always ARM64, whereas sysconfig.get_platform() can be win-arm64, win-amd64 or win32 when Python is built for different architectures and run on ARM64 Windows. So it seems like platform.architecture() is not directly related to sysconfig.get_platform(), they can be different and my change is wrong. |
Sorry, something went wrong.
There was a problem hiding this comment.
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.
| # 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.
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 a problem hiding this comment.
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 a problem hiding this comment.
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 a problem hiding this comment.
Actually while we are here, we should update the documentation as well (if it is found to be inconsistent)
Sorry, something went wrong.
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 a problem hiding this comment.
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.
|
When you're done making the requested changes, leave the comment: I have made the requested changes; please review again. |
Sorry, something went wrong.
| # Use _sysconfig.get_platform() if available | ||
| arch, bits, linkage = _sysconfig_platform() | ||
| if arch: | ||
| return arch |
There was a problem hiding this comment.
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.
|
|
||
| if not fileout and \ | ||
| executable == sys.executable: | ||
| if not fileout and executable == sys.executable: |
There was a problem hiding this comment.
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.
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.
| Back | FazBrowse Home | New Git URL |
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.