rep (magic recall) under pypy #1061

hpaulj opened this Issue Nov 28, 2011 · 3 comments


None yet

2 participants

hpaulj commented Nov 28, 2011

IPython 0.11 and running under pypy 1.6.0, magic rep does not work. More specifically

ip = get_ipython()
ip.rl_next_input = '1+3'

does nothing (i.e. does not put 1+3 on the next input line)

auto indent also does not work (since it also uses ip.readline.insert_text())
Presumably this is a pypy readline problem

fperez commented Nov 28, 2011

Unfortunately I think these are really issues for pypy, not for IPython. There's nothing we can do about it, it seems the pypy readline implementation isn't complete yet.

Closing here; feel free to reopen if you have specific evidence that there's a bug we can fix from our side.

@fperez fperez closed this Nov 28, 2011
hpaulj commented Dec 1, 2011

I think I have a solution, but it involves changing the pypy readline.raw_input(), not anything in ipython. This raw_input() invokes the startup_hook before its reader.buffer is reset. When the buffer is reset (in reader.readline() ), any readline.insert_text() action is lost.

My solution is to clear the buffer in readline.raw_input, and then hang onto the buffer contents when readline does its reset (self.prepare() ). But I have make a new reader.readline method so I don't interfere with main pypy shell loop (which uses readline.multiline_input).

It was much easier to identify the problem by running the PyMOTW sample code than to wade through multiple levels of redirection and hook definitions in ipython. :)

fperez commented Dec 1, 2011

great, at least it's a good solution for now. Eventually it might be a good idea to get these fixes integrated into pypy: its readline should behave like the python one, and that's the api ipython codes against.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment