Skip to content

fix: resolve full patch version from py-launcher executable#166

Merged
matteius merged 1 commit intomasterfrom
fix/py-launcher-full-version-matching
Mar 28, 2026
Merged

fix: resolve full patch version from py-launcher executable#166
matteius merged 1 commit intomasterfrom
fix/py-launcher-full-version-matching

Conversation

@matteius
Copy link
Copy Markdown
Contributor

Problem

py --list-paths only reports major.minor (e.g. 3.11), so PyLauncherFinder stored patch=None for every entry it created.

Callers that searched for a specific full version string — such as 3.11.9 coming from python_full_version = "3.11.9" in a Pipfile — received no match because PythonInfo.matches(patch=9) evaluated None == 9 → False, even when the exact Python version was installed and visible to py --list-paths.

This is the underlying cause of pypa/pipenv#5893.

Fix

After parsing the major.minor version string from the py launcher, query the discovered executable for its real version string (e.g. 3.11.9) via get_python_version(). The resolved version populates all fields of PythonInfo — including patch — so that full-version lookups succeed.

If the executable cannot be queried (e.g. permission error, timeout), the code falls back gracefully to the major.minor string provided by the py launcher, preserving the existing behaviour.

Behaviour before / after

Query Python in PATH? Before After
find_python_version("3.11") No (py-launcher only)
find_python_version("3.11.9") No (py-launcher only) patch=None mismatch
find_python_version("3.11.9") Yes

Pull Request opened by Augment Code with guidance from the PR author

`py --list-paths` only reports major.minor (e.g. "3.11"), so
PyLauncherFinder stored patch=None for every entry.  Searches requiring
a specific patch level (e.g. patch=9 from python_full_version="3.11.9")
therefore never matched.

After parsing the version string from the py launcher, query the
discovered executable for its real version string (e.g. "3.11.9") via
get_python_version().  Fall back gracefully to major.minor if the
executable cannot be queried.
@matteius matteius merged commit 1b44007 into master Mar 28, 2026
18 checks passed
@matteius matteius deleted the fix/py-launcher-full-version-matching branch March 28, 2026 00:02
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