I'm extending my C++ app by embedding Python 2.4.1 in it. The app is multithreaded and split into several DLL's. The main EXE calls Py_Initialize and Py_Finalize and each DLL gets a seperate interpreter with Py_NewInterpreter.
The problem comes when I try to add a new type. I've been following the "Extending and Embedding the Python Interpreter" tutorial. I've created a PyTypeObject struct like so: struct SA_PyVector { PyObject_HEAD int herman; }; static PyTypeObject SA_PyVector_Type = { PyObject_HEAD_INIT( 0 ) 0, "vector.Vector", sizeof(SA_PyVector), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Py_TPFLAGS_DEFAULT, "Vector objects", }; But if I call SA_PyVector_Type.tp_new = PyType_GenericNew; PyType_Ready( &SA_PyVector_Type ); then, when Py_Finalize is called, PyObject_IS_GC(op) in visit_decref() in gcmodule.c causes an access violation. If I don't call PyType_Ready, then the access violation doesn't occure, but then the type can't be used... So, the question is, does anyone have any idea about what could be causing this? /Bue -- http://mail.python.org/mailman/listinfo/python-list