Do not match cpython 3.10 for cpython-3.1 (#17972)

<!--
Thank you for contributing to uv! To help us out with reviewing, please
consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title?
- Does this pull request include references to any relevant issues?
-->

## Summary

<!-- What's the purpose of the change? What does it do, and why? -->
bug fix, in find version 3.1 should not match 3.10

## Test Plan

<!-- How was it tested? -->

---------

Co-authored-by: konstin <konstin@mailbox.org>
Co-authored-by: Zanie Blue <contact@zanie.dev>
This commit is contained in:
cui
2026-02-13 01:46:40 +08:00
committed by GitHub
parent 33a8132b87
commit 4ce3853c52
2 changed files with 41 additions and 8 deletions
+9 -1
View File
@@ -27,7 +27,7 @@ use which::{which, which_all};
use crate::downloads::{ManagedPythonDownloadList, PlatformRequest, PythonDownloadRequest};
use crate::implementation::ImplementationName;
use crate::installation::PythonInstallation;
use crate::installation::{PythonInstallation, PythonInstallationKey};
use crate::interpreter::Error as InterpreterError;
use crate::interpreter::{StatusCodeError, UnexpectedResponseError};
use crate::managed::{ManagedPythonInstallations, PythonMinorVersionLink};
@@ -2975,6 +2975,14 @@ impl VersionRequest {
}
}
/// Check if a [`PythonInstallationKey`] is compatible with the request.
///
/// WARNING: Use [`VersionRequest::matches_interpreter`] too. This method is only suitable to
/// avoid querying interpreters if it's clear it cannot fulfill the request.
pub(crate) fn matches_installation_key(&self, key: &PythonInstallationKey) -> bool {
self.matches_major_minor_patch_prerelease(key.major, key.minor, key.patch, key.prerelease())
}
/// Whether a patch version segment is present in the request.
fn has_patch(&self) -> bool {
match self {