How to get current function name in Python C-API? -
i implemented bunch of functions , dispatched same c function called python interpreter:
pyobject * cmddispatch(pyobject *self, pyobject *args, pyobject *kwargs) unexpectedly, self null, , need function name being called. there way information?
i have dozens of functions going through routine. command processes of options c++ map , passes along implementation of each command.
update: http://docs.python.org/extending/extending.html#a-simple-example says "the self argument points module object module-level functions; method point object instance.", getting passed null when linking against python 2.6.
the python api isn't built tell function calling. you've created function, , calling it, api assumes know function you've written. you'll need create small wrapper function each of python functions. best way register 1 c function 1 python function takes string first argument. then, in python layer, create many python functions need, each invoking c function proper string argument identifying function want call.
another alternative rethink structure of c code, , have many functions need, each of invokes common helper code process options, etc.
Comments
Post a Comment