New submission from Mark Dickinson <dicki...@gmail.com>: 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. ---------- assignee: ronaldoussoren components: Build, Extension Modules, Macintosh messages: 92457 nosy: marketdickinson, ronaldoussoren severity: normal status: open title: Support system readline on OS X 10.6 type: feature request versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue6872> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com