[ty] remove erroneous canonicalize (#21405)

Alternative implementation to
https://github.com/astral-sh/ruff/pull/21052
This commit is contained in:
Aria Desires 2025-11-12 15:47:33 -05:00 committed by GitHub
parent 2f6f3e1042
commit 3d4b0559f1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 228 additions and 6 deletions

View file

@ -452,15 +452,12 @@ pub(crate) fn dynamic_resolution_paths<'db>(
let site_packages_dir = site_packages_search_path
.as_system_path()
.expect("Expected site package path to be a system path");
let site_packages_dir = system
.canonicalize_path(site_packages_dir)
.unwrap_or_else(|_| site_packages_dir.to_path_buf());
if !existing_paths.insert(Cow::Owned(site_packages_dir.clone())) {
if !existing_paths.insert(Cow::Borrowed(site_packages_dir)) {
continue;
}
let site_packages_root = files.expect_root(db, &site_packages_dir);
let site_packages_root = files.expect_root(db, site_packages_dir);
// This query needs to be re-executed each time a `.pth` file
// is added, modified or removed from the `site-packages` directory.
@ -477,7 +474,7 @@ pub(crate) fn dynamic_resolution_paths<'db>(
// containing a (relative or absolute) path.
// Each of these paths may point to an editable install of a package,
// so should be considered an additional search path.
let pth_file_iterator = match PthFileIterator::new(db, &site_packages_dir) {
let pth_file_iterator = match PthFileIterator::new(db, site_packages_dir) {
Ok(iterator) => iterator,
Err(error) => {
tracing::warn!(