diff options
author | Terry Jan Reedy <tjreedy@udel.edu> | 2012-05-28 01:29:17 (GMT) |
---|---|---|
committer | Terry Jan Reedy <tjreedy@udel.edu> | 2012-05-28 01:29:17 (GMT) |
commit | c5301ef2df8e5ecae60decca91927d3c60fc0d77 (patch) | |
tree | 4cf17181e5020bd1556b89e113b6e2fc003b1f91 /Lib/idlelib/CallTips.py | |
parent | e1398f77ea8d3835ea3651986c54ec6bed37445d (diff) | |
download | cpython-c5301ef2df8e5ecae60decca91927d3c60fc0d77.zip cpython-c5301ef2df8e5ecae60decca91927d3c60fc0d77.tar.gz cpython-c5301ef2df8e5ecae60decca91927d3c60fc0d77.tar.bz2 |
Issue12510: Attempting to get invalid tooltip no longer closes Idle.
Original patch by Roger Serwy.
Diffstat (limited to 'Lib/idlelib/CallTips.py')
-rw-r--r-- | Lib/idlelib/CallTips.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Lib/idlelib/CallTips.py b/Lib/idlelib/CallTips.py index cda2be9..aa796cb 100644 --- a/Lib/idlelib/CallTips.py +++ b/Lib/idlelib/CallTips.py @@ -110,7 +110,9 @@ class CallTips: namespace.update(__main__.__dict__) try: return eval(name, namespace) - except (NameError, AttributeError): + # any exception is possible if evalfuncs True in open_calltip + # at least Syntax, Name, Attribute, Index, and Key E. if not + except: return None def _find_constructor(class_ob): @@ -125,9 +127,10 @@ def _find_constructor(class_ob): return None def get_argspec(ob): - """Get a string describing the arguments for the given object.""" + """Get a string describing the arguments for the given object, + only if it is callable.""" argspec = "" - if ob is not None: + if ob is not None and hasattr(ob, '__call__'): if isinstance(ob, type): fob = _find_constructor(ob) if fob is None: |