Message92457
The readline library supplied in OS X 10.6 looks good enough to use in
Python. It would be nice to enable building with this library, to avoid
having to install GNU readline.
There's a curious off-by-one difference between Apple's readline (which,
as I understand it, is just libedit wrapped to look like libreadline)
and GNU readline: with 'n' history items, the valid indices for Apple's
readline are 0 through n-1; for GNU they're 1 through n.
I was able to get Python trunk + system readline working on OS X 10.6
using the attached patch (which obviously isn't suitable for applying,
since it breaks the build with a non-system readline). A side effect of
the patch is that readline.get_history_item and friends store the first
history entry with index 0 rather than 1:
Python 2.7a0 (trunk:74735M, Sep 9 2009, 19:40:25)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import readline
[39474 refs]
>>> readline.get_history_item(0)
'import readline'
[39476 refs]
>>> readline.get_history_item(2)
'readline.get_history_item(2)'
[39476 refs]
Interestingly, the Apple-supplied Python also behaves this way:
Mark-Dickinsons-MacBook-Pro:trunk dickinsm$ python
Python 2.6.1 (r261:67515, Jul 7 2009, 23:51:51)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import readline
>>> readline.get_history_item(0)
'import readline'
>>> readline.get_history_item(2)
'readline.get_history_item(2)'
If people think this is worth pursuing, I'll put together a proper
patch. |
|
Date |
User |
Action |
Args |
2009-09-09 19:03:28 | mark.dickinson | set | recipients:
+ mark.dickinson, ronaldoussoren |
2009-09-09 19:03:28 | mark.dickinson | set | messageid: <1252523008.71.0.00362112297351.issue6872@psf.upfronthosting.co.za> |
2009-09-09 19:03:26 | mark.dickinson | link | issue6872 messages |
2009-09-09 19:03:25 | mark.dickinson | create | |
|