summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/calltip.py
diff options
context:
space:
mode:
authorTerry Jan Reedy <tjreedy@udel.edu>2019-03-24 21:12:28 (GMT)
committerGitHub <noreply@github.com>2019-03-24 21:12:28 (GMT)
commit0fe4513d9a5510ae91c0da7eb0433f79a6d4dda9 (patch)
treecf882c27dc64daf2d58af7a67a5adc2e5559129c /Lib/idlelib/calltip.py
parent6661c1720ebd322e2cb6995a243e8dc6e588d931 (diff)
downloadcpython-0fe4513d9a5510ae91c0da7eb0433f79a6d4dda9.zip
cpython-0fe4513d9a5510ae91c0da7eb0433f79a6d4dda9.tar.gz
cpython-0fe4513d9a5510ae91c0da7eb0433f79a6d4dda9.tar.bz2
bpo-36405: IDLE - Restore __main__ and add tests (#12518)
Fix error in commit 2b75155 noticed by Serhiy Storchaka.
Diffstat (limited to 'Lib/idlelib/calltip.py')
-rw-r--r--Lib/idlelib/calltip.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/idlelib/calltip.py b/Lib/idlelib/calltip.py
index 4b78917..b013a7f 100644
--- a/Lib/idlelib/calltip.py
+++ b/Lib/idlelib/calltip.py
@@ -4,6 +4,7 @@ Call Tips are floating windows which display function, class, and method
parameter and docstring information when you type an opening parenthesis, and
which disappear when you type a closing parenthesis.
"""
+import __main__
import inspect
import re
import sys
@@ -99,10 +100,10 @@ class Calltip:
def get_entity(expression):
"""Return the object corresponding to expression evaluated
- in a namespace spanning sys.modules and globals().
+ in a namespace spanning sys.modules and __main.dict__.
"""
if expression:
- namespace = {**sys.modules, **globals()}
+ namespace = {**sys.modules, **__main__.__dict__}
try:
return eval(expression, namespace) # Only protect user code.
except BaseException: