Message269096
It looks like ctypes uses ffi_closure_alloc() to allocate an executable function on demand. So it should be possible for readline to also call libffi and do this, but certainly not trivial.
>>> from ctypes import *
>>> @CFUNCTYPE(c_int, c_int, c_int)
... def operate_and_get_next(count, char):
... print("Boo!", count, char)
... return 0
...
>>> libreadline = CDLL("libreadline.so.6")
>>> libreadline.rl_add_defun("operate-and-get-next", operate_and_get_next, ord("O") & 0x1F)
0
>>> # Press Ctrl-O ==> Boo! 1 15 |
|
Date |
User |
Action |
Args |
2016-06-23 00:50:48 | martin.panter | set | recipients:
+ martin.panter, twouters, steven.daprano, Rosuav, berker.peksag, lelit |
2016-06-23 00:50:47 | martin.panter | set | messageid: <1466643047.83.0.153882025782.issue22228@psf.upfronthosting.co.za> |
2016-06-23 00:50:47 | martin.panter | link | issue22228 messages |
2016-06-23 00:50:46 | martin.panter | create | |
|