CI validation only (do not merge): win32 COM0 device path - #1
Open
JPHutchins wants to merge 1 commit into
Open
Conversation
Windows resolves only the bare names COM1 through COM9 as MS-DOS device
aliases. `serial.tools.list_ports` reports a device whose `PortName` is
COM0, but `Serial("COM0")` could not open it: the "\\.\" prefix was
applied only when the port number was greater than 8, so the bare name
was resolved as an ordinary relative file system path instead.
Prefix every COM port that Windows has no alias for, which also covers
the zero padded COM00 and COM01 spellings. COM1 through COM9 keep using
the MS-DOS device name, so no assumption is made about how well older
Windows versions accept a prefixed legacy name. Requiring COM followed
by decimal digits preserves the pass through for names such as
COMnotanumber without an `int()` call and its ValueError guard.
Extracting the rule as `device_path()` makes it testable without a
serial port.
Fixes pyserial#870
Co-Authored-By: claude-opus-5 <noreply@anthropic.com>
JPHutchins
force-pushed
the
fix-win32-com0-device-path
branch
from
July 29, 2026 18:25
572ea75 to
aedf723
Compare
JPHutchins
force-pushed
the
fix-win32-com0-device-path
branch
from
July 30, 2026 00:12
b2b3161 to
aedf723
Compare
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.
Temporary PR opened only to run the test workflow on the
windows-2025runner, since CI on the upstream PR (pyserial#871) is gated behind maintainer approval. Not for merge.