Skip to content

Commit

Permalink
Do not allow local versions in Python version requests either (#7465)
Browse files Browse the repository at this point in the history
Not user facing because this wasn't allowed previously — this addresses
a regression introduced in #7335
  • Loading branch information
zanieb authored Sep 17, 2024
1 parent 6c06181 commit a509fa1
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions crates/uv-python/src/discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1718,8 +1718,8 @@ impl FromStr for VersionRequest {
// Split the release component if it uses the wheel tag format (e.g., `38`)
let version = split_wheel_tag_release_version(version);

// We dont allow post and dev versions here
if version.post().is_some() || version.dev().is_some() {
// We dont allow post, dev, or local versions here
if version.post().is_some() || version.dev().is_some() || !version.local().is_empty() {
return Err(Error::InvalidVersionRequest(s.to_string()));
}

Expand Down Expand Up @@ -2323,6 +2323,13 @@ mod tests {
),
"Development version segments are not allowed"
);
assert!(
matches!(
VersionRequest::from_str("3.12+local"),
Err(Error::InvalidVersionRequest(_))
),
"Local version segments are not allowed"
);
assert!(
matches!(
VersionRequest::from_str("3.12.post0"),
Expand Down

0 comments on commit a509fa1

Please sign in to comment.