Repository navigation
Fix incorrect parsing of requested Python version as empty version specifiers - #4289
Conversation
| @@ -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) { | |||
There was a problem hiding this comment.
What is specifiers in this case?
There was a problem hiding this comment.
Sorry can you rephrase? It's an empty VersionSpecifiers that allows any version.
There was a problem hiding this comment.
How does "python" get parsed as an empty VersionSpecifiers? I'm just trying to understand the data flow.
There was a problem hiding this comment.
Ah yes I can answer that :)
uv/crates/uv-toolchain/src/discovery.rs
Lines 883 to 888 in 5f37395
Previously an empty remainder here would result in us not treating this as a Python version request, now it does. I didn't expect VersionSpecifiers to allow empty strings, but it makes sense in hindsight.
I'm going to need to split VersionRequest::Range out of VersionRequest (or something like that) to have the user experience I want — trying to figure out how best to do that next.
Before 0.2.10 we would parse
--python=pythonas 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 thinkVersionRequestshould support empty ranges in itsfrom_strimplementation without more consideration.