[IPython-dev] No displayhook triggered for raw 'asdf'

Fernando Perez fperez.net at gmail.com
Wed Jan 26 17:54:22 EST 2011


Hey guys,

On Sat, Jan 22, 2011 at 9:57 PM, Brian Granger <ellisonbg at gmail.com> wrote:
>
> Thomas reported this on IRC today.  In current trunk we have a bug:
>
> In [1]: "asdf"
>
> In [1]: 10
> Out[1]: 10
>
> This happens also in my display branch.

Just to let you know that I've been working on this, and I have it at
least narrowed, though not fixed yet.  The culprit is the
split_blocks() top-level function in inputsplitter, that does the
AST-based splitting.  It simply swallows silently blocks made only of
strings:

>>> from IPython.core.inputsplitter import split_blocks
>>> split_blocks("10\n")   # this is OK
['10\n']
>>> split_blocks("'asdf'\n")  # here's the bug
[]

I'm not familiar with that code, which R. Kern originally wrote, so I
haven't found a solution yet.  If anyone can pitch in who knows those
AST manipulations well, it would be great.  I'll keep hammering on it.

BTW, I have no clue as to why it's not happening on the py3k branch,
that's quite odd.

Cheers,

f



More information about the IPython-dev mailing list