if (pres !null/use and decref handler result *pyarg_parse(pres" "&cres)printf("% \ "cres)py_decref(pres)/*****************************************************/ python extension module to register handlers */python imports this module to set handler objects */*****************************************************static pyobject register_handler(pyobject *selfpyobject *args/save python callable object *py_xdecref(handler)/called before*pyarg_parse(args"( )"&handler)/one argument *py_xincref(handler)/add reference *py_incref(py_none)/return 'none'success *return py_nonestatic pyobject trigger_event(pyobject *selfpyobject *args/let python simulate event caught by *static count route_event("spam"count++)py_incref(py_none)return py_nonestatic pymethoddef cregister_methods[{"sethandler"register_handlermeth_varargs""}{"triggerevent"trigger_eventmeth_varargs""}{nullnull null}/name&func*/end of table *static struct pymoduledef cregistermodule pymoduledef_head_init"cregister"/name of module *"cregister mod"/module documentationmay be null *- /size of per-interpreter module state- =in global vars *cregister_methods /link to methods table *}pymodinit_func pyinit_cregister(/called on first import *return pymodule_create(&cregistermodule) python/ integration