mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-36405: IDLE - Restore __main__ and add tests (#12518)
Fix error in commit 2b75155
noticed by Serhiy Storchaka.
This commit is contained in:
parent
6661c1720e
commit
0fe4513d9a
5 changed files with 18 additions and 10 deletions
|
@ -3,6 +3,7 @@
|
|||
Either on demand or after a user-selected delay after a key character,
|
||||
pop up a list of candidates.
|
||||
"""
|
||||
import __main__
|
||||
import os
|
||||
import string
|
||||
import sys
|
||||
|
@ -181,7 +182,8 @@ class AutoComplete:
|
|||
else:
|
||||
if mode == COMPLETE_ATTRIBUTES:
|
||||
if what == "":
|
||||
namespace = {**__builtins__.__dict__, **globals()}
|
||||
namespace = {**__main__.__builtins__.__dict__,
|
||||
**__main__.__dict__}
|
||||
bigl = eval("dir()", namespace)
|
||||
bigl.sort()
|
||||
if "__all__" in bigl:
|
||||
|
@ -216,8 +218,8 @@ class AutoComplete:
|
|||
return smalll, bigl
|
||||
|
||||
def get_entity(self, name):
|
||||
"Lookup name in a namespace spanning sys.modules and globals()."
|
||||
return eval(name, {**sys.modules, **globals()})
|
||||
"Lookup name in a namespace spanning sys.modules and __main.dict__."
|
||||
return eval(name, {**sys.modules, **__main__.__dict__})
|
||||
|
||||
|
||||
AutoComplete.reload()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue