Skip to content

fix(sysinfo): report host architecture instead of Python process arch (fixes #58)#463

Merged
timenick merged 2 commits into
mainfrom
zhiwang/fix-sysinfo-arm64-architecture
May 7, 2026
Merged

fix(sysinfo): report host architecture instead of Python process arch (fixes #58)#463
timenick merged 2 commits into
mainfrom
zhiwang/fix-sysinfo-arm64-architecture

Conversation

@timenick

@timenick timenick commented May 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

wmk sys reports AMD64 on ARM64 Windows when running under x64 Python emulation (issue #58). The root cause is platform.machine(), which returns the architecture of the running Python process, not the host.

Fix

In _get_platform_info, resolve machine arch as:

  1. 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).
  2. PROCESSOR_ARCHITECTURE — matches the host when not under emulation.
  3. platform.machine() — final fallback.

Also drops the if system == "Windows": guard and the Linux/macOS unit tests, matching ModelKit's Windows-only scope.

Verification

  • 9/9 tests in tests/unit/sysinfo/test_sysinfo.py pass, including new ARM64 regression cases (TestWindowsHostArchitecture).
  • 130/130 in tests/unit/sysinfo/ + tests/cli/ pass.
  • Live _get_platform_info() on AMD64 Windows 11 → "machine": "AMD64".
  • In-process WOW64 simulation (PROCESSOR_ARCHITEW6432=ARM64) → "machine": "ARM64".

Hardware verification on a real ARM64 device is still recommended before closing #58.

Fixes #58

timenick added 2 commits May 7, 2026 16:08
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
@timenick timenick requested a review from a team as a code owner May 7, 2026 08:09
@timenick timenick merged commit f535844 into main May 7, 2026
9 checks passed
@timenick timenick deleted the zhiwang/fix-sysinfo-arm64-architecture branch May 7, 2026 09:40
timenick added a commit that referenced this pull request May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: sysinfo shows incorrect machine architecture (AMD64 instead of ARM64)

2 participants