fix(sysinfo): report host architecture instead of Python process arch (fixes #58)#463
Merged
Merged
Conversation
platform.machine() returns the running Python process architecture, which is wrong on ARM64 Windows when an x64 Python runs under WOW64 emulation (reports AMD64 instead of ARM64). Read PROCESSOR_ARCHITEW6432 first for the true host arch under emulation, falling back to PROCESSOR_ARCHITECTURE and platform.machine(). Also drops the non-Windows branch in _get_platform_info and the Linux/macOS tests, matching ModelKit's Windows-only scope. Fixes #58
…rm64-architecture
xieofxie
approved these changes
May 7, 2026
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
wmk sysreportsAMD64on ARM64 Windows when running under x64 Python emulation (issue #58). The root cause isplatform.machine(), which returns the architecture of the running Python process, not the host.Fix
In
_get_platform_info, resolve machine arch as:PROCESSOR_ARCHITEW6432— set by WOW64 to the true host arch when an x86/x64 process runs on a different host (e.g. x64 Python on ARM64 Windows).PROCESSOR_ARCHITECTURE— matches the host when not under emulation.platform.machine()— final fallback.Also drops the
if system == "Windows":guard and the Linux/macOS unit tests, matching ModelKit's Windows-only scope.Verification
tests/unit/sysinfo/test_sysinfo.pypass, including new ARM64 regression cases (TestWindowsHostArchitecture).tests/unit/sysinfo/+tests/cli/pass._get_platform_info()on AMD64 Windows 11 →"machine": "AMD64".PROCESSOR_ARCHITEW6432=ARM64) →"machine": "ARM64".Hardware verification on a real ARM64 device is still recommended before closing #58.
Fixes #58