Message55104
| Author |
strank |
| Recipients |
| Date |
2007年05月06日.18:07:07 |
| SpamBayes Score |
| Marked as misclassified |
| Message-id |
| In-reply-to |
| Content |
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".
|
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2007年08月23日 16:12:49 | admin | link | issue1713877 messages |
| 2007年08月23日 16:12:49 | admin | create |
|