Repository navigation
fix: handle VCS checkout CPython versions with trailing '+' in config - #579
Open
reginaldalfret wants to merge 1 commit into
Open
reginaldalfret wants to merge 1 commit into
reginaldalfret wants to merge 1 commit into
Conversation
CPython builds from a VCS checkout append '+' to the version string (e.g. '3.13.15+'). When running on such builds, packaging.version.Version rejects the bare trailing '+' with an InvalidVersion exception, causing merge_configs and default Config instantiation to fail on every file. Introduce current_python_version() helper that strips any trailing '+' from platform.python_version() before parsing as a Version, ensuring compatibility with development builds while strictly preserving user configuration validation. Closes Instagram#576 Signed-off-by: reginaldalfret <reginaldalfret@gmail.com>
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.
Summary
Fixes #576.
When running Fixit on a CPython interpreter built from a VCS branch/checkout rather than an official release tag, \platform.python_version()\ returns a version string with a trailing +\ (e.g. '3.13.15+').
In \merge_configs\ and the \Config.python_version\ default factory, initializing \Version(platform.python_version())\ fails with \packaging.version.InvalidVersion: Invalid version: '3.13.15+'\ because PEP 440 local versions require alphanumeric segments after +. This crashes \ixit lint\ on every file when run on development Python builds.
Changes
Testing
\
Ran 11 tests in 0.642s - OK
\\
\
Ran 816 tests in 27.550s - OK
\\