From 0d79865a0f4d8f9f1e94163ea9db2f99f60cfeb0 Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Wed, 29 Apr 2026 18:15:57 +0200 Subject: [PATCH] Fix __enter__ Self resolving --- jedi/inference/syntax_tree.py | 2 +- test/completion/basic.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/jedi/inference/syntax_tree.py b/jedi/inference/syntax_tree.py index bd97c939..f94db48f 100644 --- a/jedi/inference/syntax_tree.py +++ b/jedi/inference/syntax_tree.py @@ -779,7 +779,7 @@ def tree_name_to_values(inference_state, context, tree_name): coro = enter_methods.execute_with_values() return coro.py__await__().py__stop_iteration_returns() enter_methods = value_managers.py__getattribute__('__enter__') - return enter_methods.execute_with_values() + return enter_methods.execute_annotation(context) elif typ in ('import_from', 'import_name'): types = imports.infer_import(context, tree_name) elif typ in ('funcdef', 'classdef'): diff --git a/test/completion/basic.py b/test/completion/basic.py index e05c864f..d5457ea5 100644 --- a/test/completion/basic.py +++ b/test/completion/basic.py @@ -388,7 +388,8 @@ with open('') as f: #? ['closed'] f.closed for line in f: - #? str() bytes() + # TODO this is wrong + #? bytes() line with open('') as f1, open('') as f2: