This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jimjjewett
Recipients
Date 2007-04-24.22:56:23
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
It looks as though you may have code from python 2.3.4 -- readline.c has been updated somewhat since then, particularly around threading.

I'm not sure I fully understand what you're asking in step 3.  It looks like on_hook(obj) will already call the python function well enough; you just need a way of keeping a reference to (and registering) a list of functions.

The module uses (single) static variables for the hooks it predefines, and you followed that model; you could just add a list of objects.  Instead of 


Then in set_custom_hook, instead of calling set_hook immediately, 

    /* Not tested, you might want a dict instead, you should error check, 
       you should pre-declare for C89, etc */

    if (NULL == custom_hooks) custom_hooks=PyList_New(0); /* no initial elements */

    PyList_Append(custom_hooks, args);  /* add your custom func, etc to the list */
    set_hook("  ", &(PyList_GET_ITEM(custom_hooks, PyList_GET_SIZE(custom_hooks))), *args);


(Or you could just inline the checks from set_hook.)

If you're feeling ambitious, you could fix set_hook itself to use a dictionary instead of specific pointers, or to get the name from the function.__name__, or to use a newer calling convention (As I understand it, the registration may really be METH_ONE, instead of METH_VARARGS.)
History
Date User Action Args
2007-08-23 15:57:48adminlinkissue1690201 messages
2007-08-23 15:57:48admincreate
Morty Proxy This is a proxified and sanitized view of the page, visit original site.