Skip to content

fix: make CIBW_ARCHS parsing case-insensitive and platform-aware#2920

Merged
henryiii merged 1 commit into
pypa:mainfrom
henryiii:fix/windows-archs-case-insensitive
Jun 18, 2026
Merged

fix: make CIBW_ARCHS parsing case-insensitive and platform-aware#2920
henryiii merged 1 commit into
pypa:mainfrom
henryiii:fix/windows-archs-case-insensitive

Conversation

@henryiii

Copy link
Copy Markdown
Contributor

🤖 AI text below 🤖

Problem

CIBW_ARCHS architecture parsing was case-sensitive and platform-ambiguous. In cibuildwheel/architecture.py, Architecture.parse_config used a case-sensitive StrEnum lookup (cls(arch_str)). The enum carries both a lowercase arm64 member (value "arm64", used by macOS/Android) and an uppercase ARM64 member (value "ARM64", used by Windows), plus AMD64/x86_64, etc.

This caused surprising behavior:

  • Architecture.parse_config("arm64", platform="windows") returned {Architecture.arm64} (the macOS member!) with no error, then failed later in allowed_architectures_check with a confusing Invalid archs option message.
  • Architecture.parse_config("ARM64", platform="windows") worked.
  • "amd64" (lowercase) failed to parse entirely, while "AMD64" worked.

So Windows-on-ARM users had to use exact-case ARM64/AMD64.

Fix

The name lookup is now case-insensitive and resolves to the member valid for the target platform. A new helper Architecture._parse_arch_name first matches case-insensitively against Architecture.all_archs(platform), then falls back to a case-insensitive match across all members so the existing clear ConfigurationError still fires for genuinely invalid names. The special tokens (auto, native, all, auto64, auto32) are untouched.

After the fix:

  • parse_config("arm64", "windows") == {Architecture.ARM64}
  • parse_config("ARM64", "macos") == {Architecture.arm64}
  • lowercase amd64 / x86 work on Windows
  • an actually-invalid name still raises ConfigurationError

Tests

Added parametrized unit tests in unit_test/architecture_test.py covering the cases above.

Closes #2373

Architecture name lookup in `parse_config` was a case-sensitive StrEnum
lookup. Since the enum carries both lowercase `arm64` (macOS/Android) and
uppercase `ARM64` (Windows), `parse_config("arm64", "windows")` silently
returned the macOS member and later failed with a confusing "Invalid archs
option" error, while lowercase `amd64` failed to parse at all.

Resolve names case-insensitively, preferring a member valid for the target
platform before falling back to any case-insensitive match (which keeps the
clear ConfigurationError for genuinely invalid names).

Closes pypa#2373

Assisted-by: ClaudeCode:claude-opus-4.8
@henryiii henryiii force-pushed the fix/windows-archs-case-insensitive branch from 865c82c to 8bf8e69 Compare June 17, 2026 02:25

@joerick joerick left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice, yeah I imagine this has been a little paper cut for a some people.

@henryiii henryiii marked this pull request as ready for review June 18, 2026 12:19

@agriyakhetarpal agriyakhetarpal left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks! Makes sense to me. Personally, this never hit me because we documented AMD64/ARM64 in capital letters in the docs well, and I used them as such, never questioning why – but I recognise that others have been hitting it.

@henryiii henryiii merged commit dc30bfb into pypa:main Jun 18, 2026
45 checks passed
@henryiii henryiii deleted the fix/windows-archs-case-insensitive branch June 18, 2026 15:41
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.

Case sensitivity of CIBW_ARCHS for Windows on ARM64

3 participants