(original) (raw)

changeset: 77194:938b12452af7 branch: 2.7 parent: 77188:df59aefdb1c8 user: Terry Jan Reedy tjreedy@udel.edu date: Sun May 27 21:28:42 2012 -0400 files: Lib/idlelib/CallTips.py Misc/NEWS description: Issue12510: Attempting to get invalid tooltip no longer closes Idle. Original patch by Roger Serwy. diff -r df59aefdb1c8 -r 938b12452af7 Lib/idlelib/CallTips.py --- a/Lib/idlelib/CallTips.py Sun May 27 17:13:54 2012 -0400 +++ b/Lib/idlelib/CallTips.py Sun May 27 21:28:42 2012 -0400 @@ -112,7 +112,9 @@ 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): @@ -127,9 +129,10 @@ return None def get_arg_text(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.""" arg_text = "" - if ob is not None: + if ob is not None and hasattr(ob, '__call__'): arg_offset = 0 if type(ob) in (types.ClassType, types.TypeType): # Look for the highest __init__ in the class chain. diff -r df59aefdb1c8 -r 938b12452af7 Misc/NEWS --- a/Misc/NEWS Sun May 27 17:13:54 2012 -0400 +++ b/Misc/NEWS Sun May 27 21:28:42 2012 -0400 @@ -64,6 +64,9 @@ Library ------- +- Issue12510: Attempting to get invalid tooltip no longer closes Idle. + Original patch by Roger Serwy. + - Issue #10365: File open dialog now works instead of crashing even when parent window is closed. Patch by Roger Serwy. /tjreedy@udel.edu