@@ -67,18 +67,18 @@ def open_calltip(self, evalfuncs):
6767 if not sur_paren :
6868 return
6969 hp .set_index (sur_paren [0 ])
70- name = hp .get_expression ()
71- if not name :
70+ expression = hp .get_expression ()
71+ if not expression :
7272 return
73- if not evalfuncs and (name .find ('(' ) != - 1 ):
73+ if not evalfuncs and (expression .find ('(' ) != - 1 ):
7474 return
75- argspec = self .fetch_tip (name )
75+ argspec = self .fetch_tip (expression )
7676 if not argspec :
7777 return
7878 self .active_calltip = self ._calltip_window ()
7979 self .active_calltip .showtip (argspec , sur_paren [0 ], sur_paren [1 ])
8080
81- def fetch_tip (self , name ):
81+ def fetch_tip (self , expression ):
8282 """Return the argument list and docstring of a function or class.
8383
8484 If there is a Python subprocess, get the calltip there. Otherwise,
@@ -94,25 +94,27 @@ def fetch_tip(self, name):
9494 """
9595 try :
9696 rpcclt = self .editwin .flist .pyshell .interp .rpcclt
97- except :
97+ except AttributeError :
9898 rpcclt = None
9999 if rpcclt :
100100 return rpcclt .remotecall ("exec" , "get_the_calltip" ,
101- (name ,), {})
101+ (expression ,), {})
102102 else :
103- entity = self .get_entity (name )
103+ entity = self .get_entity (expression )
104104 return get_argspec (entity )
105105
106- def get_entity (self , name ):
107- "Lookup name in a namespace spanning sys.modules and __main.dict__."
108- if name :
106+ def get_entity (self , expression ):
107+ """Return the object corresponding to expression evaluated
108+ in a namespace spanning sys.modules and __main.dict__.
109+ """
110+ if expression :
109111 namespace = sys .modules .copy ()
110112 namespace .update (__main__ .__dict__ )
111113 try :
112- return eval (name , namespace )
113- # any exception is possible if evalfuncs True in open_calltip
114- # at least Syntax, Name, Attribute, Index, and Key E. if not
115- except :
114+ return eval (expression , namespace )
115+ except BaseException :
116+ # An uncaught exception closes idle, and eval can raise any
117+ # exception, especially if user classes are involved.
116118 return None
117119
118120def _find_constructor (class_ob ):
0 commit comments