gh-98878: Use builtins from the bound frame when offering a suggestion (#98880)

This commit is contained in:
Batuhan Taskaya 2022-10-31 16:27:13 +03:00 committed by GitHub
parent 39448adc9d
commit a41de32942
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 1 deletions

View file

@ -1035,7 +1035,7 @@ def _compute_suggestion_error(exc_value, tb, wrong_name):
d = (
list(frame.f_locals)
+ list(frame.f_globals)
+ list(frame.f_globals['__builtins__'])
+ list(frame.f_builtins)
)
if len(d) > _MAX_CANDIDATE_ITEMS:
return None