From 8d54996ffbb77f2840d126d7a2ec98e44bd08df2 Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Tue, 1 Oct 2024 14:01:36 -0400 Subject: [PATCH] Avoid indirection in `class.__call__` lookup (#13595) --- crates/red_knot_python_semantic/src/types.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/crates/red_knot_python_semantic/src/types.rs b/crates/red_knot_python_semantic/src/types.rs index 2268183d1d..1e2d2500ca 100644 --- a/crates/red_knot_python_semantic/src/types.rs +++ b/crates/red_knot_python_semantic/src/types.rs @@ -616,8 +616,7 @@ impl<'db> Type<'db> { Type::Instance(class) => { // Since `__call__` is a dunder, we need to access it as an attribute on the class // rather than the instance (matching runtime semantics). - let meta_ty = Type::Class(class); - let dunder_call_method = meta_ty.member(db, "__call__"); + let dunder_call_method = class.class_member(db, "__call__"); if dunder_call_method.is_unbound() { CallOutcome::not_callable(self) } else {