[issue12510] IDLE get_the_calltip mishandles raw strings

Terry J. Reedy report at bugs.python.org
Mon May 28 02:10:44 CEST 2012


Terry J. Reedy <tjreedy at udel.edu> added the comment:

'a'(, [](, {}( no longer do anything.
[int][0]( and {0:int}[0] bring up int tooltip.

However, patch is not a complete fix yet.
[int][1]( and {0:int}[1] both 'crash' Idle.
So we need to add IndexError and KeyError to
+            except (NameError, AttributeError, SyntaxError):

I think instead we should just remove the list since any uncaught error in the eval will close Idle. Do you see any reason why not? If open_calltips were called with evalfuncs True (I presume there must be a way, see below), then *any* exception could happen in the eval.

I was thinking that eval is a bit dangerous but I see this protection in open_calltips"

        if not evalfuncs and (name.find('(') != -1):
            return

Consequently, after "def f(): return int", f()( does not get a calltip. Neither does the tuple equivalent of the list example above, (int,)[0](.

With the call check moved from the bottom of get_argspec to the top, I am ok with it there. If we agree on the except clause, I am ready to apply.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12510>
_______________________________________


More information about the Python-bugs-list mailing list