Skip to content

spawn/call: don't force param cmd to be mutable + allow more kwargs on msvc - #390

Open
Avasam wants to merge 1 commit into
pypa:mainfrom
Avasam:def-spawn-better-types
Open

spawn/call: don't force param cmd to be mutable + allow more kwargs on msvc#390
Avasam wants to merge 1 commit into
pypa:mainfrom
Avasam:def-spawn-better-types

Conversation

@Avasam

@Avasam Avasam commented Dec 20, 2025

Copy link
Copy Markdown
Contributor

This has 2 advantages:

  • cmd doesn't have to be mutable. So tuples are usable
  • It actually improves the generic type because MutableSequence is invariant. which can cause issues with union types since you need to match the exact full union type (some checkers do allow partial union match for inline/literal sequences)
    • Needed to resolve all mypy [arg-type]

I also improved the possible param types by using an overload on search_path (since search_path allows bytes | str | PathLike[str], but not PathLike[bytes])

Open question: Since verbose isn't used in spawn, maybe it's better to not even expose it as a possible kwargs in Compiler classes ? (no runtime change, just hiding it from the type annotation in wrapper methods)


Edit: Updated with 3f09fab

@Avasam

Avasam commented Dec 20, 2025

Copy link
Copy Markdown
Contributor Author

Comment thread distutils/compilers/C/base.py Outdated
@Avasam
Avasam force-pushed the def-spawn-better-types branch 2 times, most recently from ed891f5 to fe21a7f Compare July 4, 2026 19:08
@Avasam
Avasam force-pushed the def-spawn-better-types branch 8 times, most recently from 079d4ab to c9b7218 Compare July 9, 2026 23:16
@Avasam Avasam changed the title spawn: don't force param cmd to be mutable spawn: don't force param cmd to be mutable + allow more kwargs on msvc Jul 9, 2026
@Avasam
Avasam force-pushed the def-spawn-better-types branch 3 times, most recently from 342d873 to c0c5654 Compare July 11, 2026 01:56
@Avasam
Avasam force-pushed the def-spawn-better-types branch from c0c5654 to fe8e8c1 Compare August 3, 2026 14:36
@Avasam Avasam changed the title spawn: don't force param cmd to be mutable + allow more kwargs on msvc spawn/call: don't force param cmd to be mutable + allow more kwargs on msvc Aug 3, 2026
@Avasam
Avasam force-pushed the def-spawn-better-types branch from fe8e8c1 to 6842a4c Compare August 3, 2026 14:51
@Avasam

Avasam commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

Simplified a lot with 3f09fab

@Avasam
Avasam force-pushed the def-spawn-better-types branch 2 times, most recently from d16129e to c96f0be Compare August 3, 2026 15:06
@Avasam
Avasam force-pushed the def-spawn-better-types branch from c96f0be to 8553db5 Compare August 11, 2026 16:53
Avasam added a commit to Avasam/typeshed that referenced this pull request Aug 11, 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.

1 participant