Issue12510: Attempting to get invalid tooltip no longer closes Idle.
authorTerry Jan Reedy <tjreedy@udel.edu>
Mon, 28 May 2012 01:28:42 +0000 (21:28 -0400)
committerTerry Jan Reedy <tjreedy@udel.edu>
Mon, 28 May 2012 01:28:42 +0000 (21:28 -0400)
Original patch by Roger Serwy.

Lib/idlelib/CallTips.py
Misc/NEWS

index f8f31e2fcb4368c988411934c113c60d2ec1bcee..ce09983eec75a92e29ae0522808612db5b689622 100644 (file)
@@ -112,7 +112,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):
@@ -127,9 +129,10 @@ def _find_constructor(class_ob):
     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.
index 6a0ce9e13b2848e7d79fba7bd92f6b4d039f428b..f8d7884ceeb796384eff64c74b1c67cb51bf6123 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -64,6 +64,9 @@ Core and Builtins
 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.