[capi-sig] Passing non-PyObjects as args to PyObject_CallObject

Hrvoje Niksic hniksic at xemacs.org
Mon Oct 27 14:12:04 CET 2008


"Sudharshan S" <sudharsh at gmail.com> writes:

> My project uses GLib's GObject and recently I thought of adding
> support for executing python scripts by embedding the interpreter
> within the code.  However there is this need to pass a GOB struct as
> one of the parameters to a function in the python script. How
> exactly do I pass non-PyObject types with the API?

The gobject wrapper probably supports converting a GObject instance to
a PyGobject visible from Python.  Failing that, you can always create
a PyCObject (an opaque object containing a pointer) and use it to pass
the pointer to your struct.

http://docs.python.org/c-api/cobject.html


More information about the capi-sig mailing list