Repository navigation
Conversation
…uded _target_versions_exceed_runtime previously compared only the maximum target version against the runtime. This caused a false positive warning when users specified multiple --target-version flags including their current Python version alongside a future one. For example, running Python 3.14 with: -t py310 -t py311 -t py312 -t py313 -t py314 -t py315 would incorrectly warn that 3.14 cannot parse code formatted for 3.15, even though 3.14 is explicitly listed as a target. The fix checks whether ALL target versions exceed the runtime. If at least one target version matches the runtime, no warning is needed.
2 of 4 tasks
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.
Problem
_target_versions_exceed_runtimecompares only the maximum target version against the runtime. This causes a false positive when users specify multiple target versions including their current Python.Example: running Python 3.14 with
-t py310 -t py311 -t py312 -t py313 -t py314 -t py315shows:This warning is misleading — the user explicitly asked for 3.14-compatible output by including it in the target list.
Fix
Changed
_target_versions_exceed_runtimeto check whether all target versions exceed the runtime, not just the maximum. If any target version is ≤ the runtime version, the formatted output will be parseable and no warning is needed.Closes #5164
Closes #5167