Skip to content

Commit

Permalink
Fix incorrect parsing of requested Python version as empty version sp…
Browse files Browse the repository at this point in the history
…ecifiers (#4289)

Before 0.2.10 we would parse `--python=python` as an executable name.
After #4214, we started treating
this as a Python version range request (with an empty version range).
This is not entirely unreasonable, but it was an unexpected regression
and I don't think `VersionRequest` should support empty ranges in its
`from_str` implementation without more consideration.
  • Loading branch information
zanieb authored Jun 13, 2024
1 parent a547d7f commit b43de79
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crates/uv-toolchain/src/discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1237,6 +1237,9 @@ impl FromStr for VersionRequest {
Ok(selector)
// e.g. `>=3.12.1,<3.12`
} else if let Ok(specifiers) = VersionSpecifiers::from_str(s) {
if specifiers.is_empty() {
return Err(Error::InvalidVersionRequest(s.to_string()));
}
Ok(Self::Range(specifiers))
} else {
Err(Error::InvalidVersionRequest(s.to_string()))
Expand Down

0 comments on commit b43de79

Please sign in to comment.