summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/calltip.py
diff options
context:
space:
mode:
authorTerry Jan Reedy <tjreedy@udel.edu>2019-03-23 07:50:15 (GMT)
committerGitHub <noreply@github.com>2019-03-23 07:50:15 (GMT)
commit2b75155590eb42d25e474b776ee9fdcc4b3dc840 (patch)
treebae874d3d2c176b92a88b27f6918d66516c08ef5 /Lib/idlelib/calltip.py
parent7a2e84c3488cfd6c108c6b41ff040825f1757566 (diff)
downloadcpython-2b75155590eb42d25e474b776ee9fdcc4b3dc840.zip
cpython-2b75155590eb42d25e474b776ee9fdcc4b3dc840.tar.gz
cpython-2b75155590eb42d25e474b776ee9fdcc4b3dc840.tar.bz2
bpo-36405: Use dict unpacking in idlelib (#12507)
Remove now unneeded imports.
Diffstat (limited to 'Lib/idlelib/calltip.py')
-rw-r--r--Lib/idlelib/calltip.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/Lib/idlelib/calltip.py b/Lib/idlelib/calltip.py
index 2a9a131..4b78917 100644
--- a/Lib/idlelib/calltip.py
+++ b/Lib/idlelib/calltip.py
@@ -12,7 +12,6 @@ import types
from idlelib import calltip_w
from idlelib.hyperparser import HyperParser
-import __main__
class Calltip:
@@ -100,13 +99,12 @@ class Calltip:
def get_entity(expression):
"""Return the object corresponding to expression evaluated
- in a namespace spanning sys.modules and __main.dict__.
+ in a namespace spanning sys.modules and globals().
"""
if expression:
- namespace = sys.modules.copy()
- namespace.update(__main__.__dict__)
+ namespace = {**sys.modules, **globals()}
try:
- return eval(expression, namespace)
+ return eval(expression, namespace) # Only protect user code.
except BaseException:
# An uncaught exception closes idle, and eval can raise any
# exception, especially if user classes are involved.