[Ironpython-users] raw_input and readline support in ironpython

Jeff Hardy jdhardy at gmail.com
Tue Jun 26 00:58:57 CEST 2012


On Sun, Jun 24, 2012 at 11:10 AM, Pawel Jasinski
<pawel.jasinski at gmail.com> wrote:
> hi,
>
> the documentation of raw_input says:
>
> "If the readline module was loaded, then raw_input() will use it to
> provide elaborate line editing and history features."
>
> Which translates to calling raw_input equivalent inside readline module.
>
> In case of cpython readline is built-in and there is no public
> interface for it.
> Readline knows about and has direct access to the internals of python
> and swaps the raw_input implementation.
>
> In case of ironpython it is different.
> Readline is an external module.
> It used to work by tinkering with console internal state.
> This was done in 1.x days, required patching of ironpython code and is
> broken now.
>
> I would like to fix it.
> So far I have modified raw_input to check if readliine was loaded and
> call internal things of the readline module.
> It appears to work but is there a better way?

As long as it works without readline, and it's not *too* terrible of a
hack, that should be fine. There are a few modules (zipimport comes to
mind) that slot into CPython in weird ways, and we might be stuck with
them.

It might be interesting to use some of the functionality in
SuperConsole to implement history w/o readline, but I imagine
readline's specific details (C-r, C-e, C-a, etc.) are wired into a lot
of people's fingers, and so having the actual readline available is
probably a good idea.

All the more reason to fix the packaging story for IronPython so that
readline can be easily distributed.

- Jeff


More information about the Ironpython-users mailing list