Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c5301ef

Browse files
committed
Issue12510: Attempting to get invalid tooltip no longer closes Idle.
Original patch by Roger Serwy.
1 parent e1398f7 commit c5301ef

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

Lib/idlelib/CallTips.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,9 @@ def get_entity(self, name):
110110
namespace.update(__main__.__dict__)
111111
try:
112112
return eval(name, namespace)
113-
except (NameError, AttributeError):
113+
# any exception is possible if evalfuncs True in open_calltip
114+
# at least Syntax, Name, Attribute, Index, and Key E. if not
115+
except:
114116
return None
115117

116118
def _find_constructor(class_ob):
@@ -125,9 +127,10 @@ def _find_constructor(class_ob):
125127
return None
126128

127129
def get_argspec(ob):
128-
"""Get a string describing the arguments for the given object."""
130+
"""Get a string describing the arguments for the given object,
131+
only if it is callable."""
129132
argspec = ""
130-
if ob is not None:
133+
if ob is not None and hasattr(ob, '__call__'):
131134
if isinstance(ob, type):
132135
fob = _find_constructor(ob)
133136
if fob is None:

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ Core and Builtins
6767
Library
6868
-------
6969

70+
- Issue12510: Attempting to get invalid tooltip no longer closes Idle.
71+
Original patch by Roger Serwy.
72+
7073
- Issue #10365: File open dialog now works instead of crashing
7174
even when parent window is closed. Patch by Roger Serwy.
7275

0 commit comments

Comments
 (0)