Reuse refined interpreter to create tool environment (#11680)

## Summary

As-is, we used the refined interpreter to _resolve_, but we then created
the tool environment with the "old" interpreter. So we risked running
(e.g.) code that requires Python 3.12 in a Python 3.10 environment. We
need to propagate the updated interpreter.

This is fairly hard to test, because it requires an environment in which
we're able to download new interpreters.

Closes
https://github.com/astral-sh/uv/issues/11678#issuecomment-2672659074.
This commit is contained in:
Charlie Marsh 2025-02-20 14:05:03 -08:00 committed by GitHub
parent 88f0dfd03d
commit 36268fbe12
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 3 deletions

View File

@ -454,8 +454,8 @@ pub(crate) async fn install(
.await;
// If the resolution failed, retry with the inferred `requires-python` constraint.
let resolution = match resolution {
Ok(resolution) => resolution,
let (resolution, interpreter) = match resolution {
Ok(resolution) => (resolution, interpreter),
Err(err) => match err {
ProjectError::Operation(err) => {
// If the resolution failed due to the discovered interpreter not satisfying the
@ -505,7 +505,7 @@ pub(crate) async fn install(
)
.await
{
Ok(resolution) => resolution,
Ok(resolution) => (resolution, interpreter),
Err(ProjectError::Operation(err)) => {
return diagnostics::OperationDiagnostic::native_tls(native_tls)
.report(err)