mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-30 05:44:56 +00:00
[ty] Fix namespace packages that behave like partial stubs (#19994)
In implementing partial stubs I had observed that this continue in the namespace package code seemed erroneous since the same continue for partial stubs didn't work. Unfortunately I wasn't confident enough to push on that hunch. Fortunately I remembered that hunch to make this an easy fix. The issue with the continue is that it bails out of the current search-path without testing any .py files. This breaks when for example `google` and `google-stubs`/`types-google` are both in the same site-packages dir -- failing to find a module in `types-google` has us completely skip over `google`! Fixes https://github.com/astral-sh/ty/issues/520
This commit is contained in:
parent
58efd19f11
commit
c82e255ca8
2 changed files with 58 additions and 14 deletions
|
@ -723,8 +723,7 @@ fn resolve_name(db: &dyn Db, name: &ModuleName, mode: ModuleResolveMode) -> Opti
|
|||
`{name}` but it is a namespace package, keep going."
|
||||
);
|
||||
// stub exists, but the module doesn't. But this is a namespace package,
|
||||
// keep searching the next search path for a stub package with the same name.
|
||||
continue;
|
||||
// fall through to looking for a non-stub package
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue