Issue 1713877: Expose callback API in readline module (original) (raw)

Created on 2007-05-06 18:07 by strank, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (5)
msg55104 - (view) Author: strank (strank) Date: 2007-05-06 18:07
This is a request to expose the `callback API`_ of GNU readline in the readline module in the Python library. .. _callback API: http://cnswww.cns.cwru.edu/php/chet/readline/readline.html#SEC41 This interface is suitable for asynchronous use, such as with twisted. It is possible to expose the functions on Unix with ctypes:: import readline import ctypes rl_lib = ctypes.cdll.LoadLibrary("libreadline.so.5") readline.callback_handler_remove = rl_lib.rl_callback_handler_remove readline.callback_read_char = rl_lib.rl_callback_read_char # the callback needs special treatment: rlcallbackfunctype = ctypes.CFUNCTYPE(ctypes.c_void_p, ctypes.c_char_p) def setcallbackfunc(prompt, thefunc): rl_lib.rl_callback_handler_install(prompt, rlcallbackfunctype(thefunc)) readline.callback_handler_install = setcallbackfunc but it would be much better to expose them "officially".
msg59362 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2008-01-06 12:43
A patch is always welcome
msg59435 - (view) Author: strank (strank) Date: 2008-01-07 07:13
I am pretty sure I posted a patch in the sf patch tracker... oh yes, here it is: http://bugs.python.org/issue1744456 I think it still needs some work if you want to make it impossible for users of the API to wreck the interactive prompt. If this possibility is considered ok (it does not make sense to use the callback api from the interactive prompt anyway), I think it's ok. But someone with more readline experience should probably look at it... :-)
msg109839 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2010-07-10 10:11
Can this be closed as a duplicate as Issue1744456 has a patch?
msg109842 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2010-07-10 10:26
Yes, that makes sense (the two issues come from the SourceForge era, where bugs and patches had different trackers).
History
Date User Action Args
2022-04-11 14:56:24 admin set github: 44935
2010-07-10 10:26:25 georg.brandl set status: open -> closeddependencies: - Expose non-blocking callbackAPI in readline modulesuperseder: Expose non-blocking callbackAPI in readline modulenosy: + georg.brandlmessages: + resolution: duplicate
2010-07-10 10:11:16 BreamoreBoy set nosy: + BreamoreBoymessages: +
2009-04-06 10:30:11 ajaksu2 set dependencies: + Expose non-blocking callbackAPI in readline moduleversions: + Python 3.1, Python 2.7, - Python 2.6
2008-01-07 07:13:04 strank set messages: +
2008-01-06 12:43:11 christian.heimes set nosy: + christian.heimesmessages: +
2008-01-06 12:43:02 christian.heimes set versions: + Python 2.6
2007-05-06 18:07:07 strank create