{"issue":{"created_at":"2011-11-28T08:22:26Z","state":"closed","updated_at":"2011-12-01T03:21:29Z","comments":2,"user":{"gravatar_id":"5060f4ce01acc6642c0fb4d57aa94a60","id":1126648,"url":"https://api.github.com/users/hpaulj","avatar_url":"https://secure.gravatar.com/avatar/5060f4ce01acc6642c0fb4d57aa94a60?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"hpaulj"},"body":"IPython 0.11 and 0.12.dev running under pypy 1.6.0, magic rep does not work.  More specifically \r\n\r\nip = get_ipython()\r\nip.rl_next_input = '1+3'\r\n\r\ndoes nothing (i.e. does not put 1+3 on the next input line)\r\n\r\nauto indent also does not work (since it also uses ip.readline.insert_text())\r\nPresumably this is a pypy readline problem\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n","assignee":null,"id":2364952,"labels":[],"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"number":1061,"title":"rep (magic recall) under pypy","closed_at":"2011-11-28T08:27:07Z","html_url":"https://github.com/ipython/ipython/issues/1061","url":"https://api.github.com/repos/ipython/ipython/issues/1061","milestone":null},"action":"created","comment":{"created_at":"2011-12-01T03:21:29Z","updated_at":"2011-12-01T03:21:29Z","user":{"gravatar_id":"5060f4ce01acc6642c0fb4d57aa94a60","id":1126648,"url":"https://api.github.com/users/hpaulj","avatar_url":"https://secure.gravatar.com/avatar/5060f4ce01acc6642c0fb4d57aa94a60?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"hpaulj"},"body":"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.\r\n\r\nMy 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).\r\n\r\nIt was much easier to identify the problem by running the PyMOTW readline_hooks.py sample code than to wade through multiple levels of redirection and hook definitions in ipython.  :) \r\n","id":2970358,"url":"https://api.github.com/repos/ipython/ipython/issues/comments/2970358"}}