]> granicus.if.org Git - python/commitdiff
Issue12510: Attempting to get invalid tooltip no longer closes Idle.
authorTerry Jan Reedy <tjreedy@udel.edu>
Mon, 28 May 2012 01:29:17 +0000 (21:29 -0400)
committerTerry Jan Reedy <tjreedy@udel.edu>
Mon, 28 May 2012 01:29:17 +0000 (21:29 -0400)
Original patch by Roger Serwy.

Lib/idlelib/CallTips.py
Misc/NEWS

index cda2be979d2df7e44756c1169c2fcfd0bfae8b3e..aa796cb47dcec4074ef567700bd71264af1d6896 100644 (file)
@@ -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:
index 4cafa5df6a456716e08a870ee9296295c3b97343..3ea0ae30dff68a1818281fbdcc1174e0f9cc5657 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -67,6 +67,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.