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:

_PyThreadState_Current->curexc_type


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);

0 Comments:

Post a Comment



<$I18N$LinksToThisPost>:

Create a Link

<< Home