[ python-Feature Requests-1713877 ] Expose callback API in readline module
SourceForge.net
noreply at sourceforge.net
Sun May 6 20:07:07 CEST 2007
Feature Requests item #1713877, was opened at 2007-05-06 20:07
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1713877&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: strank (strank)
Assigned to: Nobody/Anonymous (nobody)
Summary: Expose callback API in readline module
Initial Comment:
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".
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1713877&group_id=5470
More information about the Python-bugs-list
mailing list