a life of coding

Friday, July 06, 2007

Working with Python/C

Some very short notes for working with python from C. I'm using Python 2.4.x, YMMV.

Getting the current error state inside your debugger:


Instantiating a "New Style" class (a subclass of "object"):

PyObject* args = PyTuple_New(0);
PyObject* dict = PyDict_New();

// works only with new style classes (subclasses of "object")
PyObject* result = PyObject_Call(classObject, args, dict);


Post a Comment


Create a Link

<< Home