We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 91aa75a commit 6a80618Copy full SHA for 6a80618
crates/ty_python_semantic/src/types/infer.rs
@@ -3948,8 +3948,9 @@ impl<'db> TypeInferenceBuilder<'db> {
3948
3949
// Avoid looking up attributes on a module if a module imports from itself
3950
// (e.g. `from parent import submodule` inside the `parent` module).
3951
- let import_is_self_referential =
3952
- file_to_module(self.db(), self.file()).is_some_and(|m| m.name() == &module_name);
+ let import_is_self_referential = module_ty
+ .into_module_literal()
3953
+ .is_some_and(|module| self.file() == module.module(self.db()).file());
3954
3955
// First try loading the requested attribute from the module.
3956
if !import_is_self_referential {
0 commit comments