summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorSenthil Kumaran <senthil@uthcode.com>2012-06-03 08:16:39 (GMT)
committerSenthil Kumaran <senthil@uthcode.com>2012-06-03 08:16:39 (GMT)
commitfe4dfd2b65850f0cddec700e2f747fec611b4be9 (patch)
tree37acd3c73a0a549f35235bb145c8a60a928b3071 /Lib
parent1251fafcc57091d952bb1cc9b1e1a77f39c59b7b (diff)
parent2168b31cac93aa36273dc5974db5fb446a6679eb (diff)
downloadcpython-fe4dfd2b65850f0cddec700e2f747fec611b4be9.zip
cpython-fe4dfd2b65850f0cddec700e2f747fec611b4be9.tar.gz
cpython-fe4dfd2b65850f0cddec700e2f747fec611b4be9.tar.bz2
merge heads
Diffstat (limited to 'Lib')
-rw-r--r--Lib/idlelib/CallTips.py32
1 files changed, 17 insertions, 15 deletions
diff --git a/Lib/idlelib/CallTips.py b/Lib/idlelib/CallTips.py
index aa796cb..22a8a29 100644
--- a/Lib/idlelib/CallTips.py
+++ b/Lib/idlelib/CallTips.py
@@ -67,18 +67,18 @@ class CallTips:
if not sur_paren:
return
hp.set_index(sur_paren[0])
- name = hp.get_expression()
- if not name:
+ expression = hp.get_expression()
+ if not expression:
return
- if not evalfuncs and (name.find('(') != -1):
+ if not evalfuncs and (expression.find('(') != -1):
return
- argspec = self.fetch_tip(name)
+ argspec = self.fetch_tip(expression)
if not argspec:
return
self.active_calltip = self._calltip_window()
self.active_calltip.showtip(argspec, sur_paren[0], sur_paren[1])
- def fetch_tip(self, name):
+ def fetch_tip(self, expression):
"""Return the argument list and docstring of a function or class.
If there is a Python subprocess, get the calltip there. Otherwise,
@@ -94,25 +94,27 @@ class CallTips:
"""
try:
rpcclt = self.editwin.flist.pyshell.interp.rpcclt
- except:
+ except AttributeError:
rpcclt = None
if rpcclt:
return rpcclt.remotecall("exec", "get_the_calltip",
- (name,), {})
+ (expression,), {})
else:
- entity = self.get_entity(name)
+ entity = self.get_entity(expression)
return get_argspec(entity)
- def get_entity(self, name):
- "Lookup name in a namespace spanning sys.modules and __main.dict__."
- if name:
+ def get_entity(self, expression):
+ """Return the object corresponding to expression evaluated
+ in a namespace spanning sys.modules and __main.dict__.
+ """
+ if expression:
namespace = sys.modules.copy()
namespace.update(__main__.__dict__)
try:
- return eval(name, namespace)
- # any exception is possible if evalfuncs True in open_calltip
- # at least Syntax, Name, Attribute, Index, and Key E. if not
- except:
+ return eval(expression, namespace)
+ except BaseException:
+ # An uncaught exception closes idle, and eval can raise any
+ # exception, especially if user classes are involved.
return None
def _find_constructor(class_ob):