[issue12510] IDLE get_the_calltip mishandles raw strings

Terry J. Reedy report at bugs.python.org
Sun May 27 09:31:13 CEST 2012


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

With 2.7 & 3.3 on Win 7, 'a'( brings up calltip (bad).
With 3.3, '\xyz'( causes Idle to die (worse)
With 2.7, the same or u'\xyz'( have no effect, just like 3(.

There are a lot of little differences between 2.7 and 3.x, but the main one is the use of inspect in 3.x. I do not see an obvious reason for the behavior difference.

With patch, 'a'( brings up calltip with 'Not callable' added (worse, in my opinion), while '\xyz'( does nothing, just like 3( (or 2.7, great).

Roger, perhaps you uploaded your initial test past instead of the final patch. A string instance should act like any other non-callable instance.

That said, the patch strikes me as attacking the problem at the wrong end. Str instances are not names and get_argspec should never be called on one (I am presuming that it is not called on other non-callables, such as int instances). Similarly, back up further in the call stack, fetch_tip(name) should only be called on names. I wonder if the problem might be back up in open_calltip(), perhaps after

        hp = HyperParser(self.editwin, "insert")
        sur_paren = hp.get_surrounding_brackets('(')
        if not sur_paren:
            return
        hp.set_index(sur_paren[0])
        name = hp.get_expression()

(argggh! I have no idea how to debug code where I cannot just insert print statements to tell me what is getting called with what arguments.)

----------
versions: +Python 2.7, Python 3.3

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


More information about the Python-bugs-list mailing list