[Python-checkins] cpython (merge 3.2 -> default): Merge 3.2 closes #12510

terry.reedy python-checkins at python.org
Mon May 28 03:55:04 CEST 2012


http://hg.python.org/cpython/rev/0835bee19f86
changeset:   77196:0835bee19f86
parent:      77192:17341b51af4f
parent:      77195:4a7582866735
user:        Terry Jan Reedy <tjreedy at udel.edu>
date:        Sun May 27 21:39:39 2012 -0400
summary:
  Merge 3.2 closes #12510

files:
  Lib/idlelib/CallTips.py |  9 ++++++---
  Misc/NEWS               |  3 +++
  2 files changed, 9 insertions(+), 3 deletions(-)


diff --git a/Lib/idlelib/CallTips.py b/Lib/idlelib/CallTips.py
--- a/Lib/idlelib/CallTips.py
+++ b/Lib/idlelib/CallTips.py
@@ -110,7 +110,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):
@@ -125,9 +127,10 @@
         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:
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -49,6 +49,9 @@
 Library
 -------
 
+- Issue12510: Attempting to get invalid tooltip no longer closes Idle.
+  Original patch by Roger Serwy.
+
 - Issue #14925: email now registers a defect when the parser decides that there
   is a missing header/body separator line.  MalformedHeaderDefect, which the
   existing code would never actually generate, is deprecated.

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list