I called a own python type 'PyType' with a c function and returned it into my python programm - there it fault. It is said that the object has a NULL-Pointer when I try to debug it?
Here are the importent snips from my code: // == test.py ========================================================= . : myNewPyType = PyMyExtention.GetValue ("xxx") # printings for testing print "...back to python... test.py" print "pp\t ...PyMyType.PyMyObject:", type(tySdlXml) //===================================================================/ // == PyMyExtention.c ================================================= . : static PyObject* wrap_GetValue (PyObject* self, PyObject* args) { char* pchXXX; if (!PyArg_ParseTuple(args, "s", &pchXXX)) { return 0; } long llong = CFunktion::CallMe(pchXXX); // returning Python-Objekt PyObject *pyType = PyMyObject_NewC (llong); cout << "cc ..." << ((PyMyType*)pyType)->lAttribute << endl; cout << "\t ...proof object-valid pointer?" << (void*)pyType << endl; return (PyObject*)pyType; } . : //===================================================================/ // == PyMyExtention.c ================================================= . : typedef struct { PyObject_HEAD long lAttribute; } PyMyObject; static PyObject* PyMyObject_NewC (long lAttribute) { PySDLXMLNode *self; PySDLXMLNode *type; self = new PySDLXMLNode; self->lAttribute = lAttribute; return (PyObject*)self; } static PyMethodDef PyMyObject_methods[] = { {"PyMyObject_NewC", (PyCFunction)PyMyObject_NewC, METH_NOARGS, "Create PyMyObject_NewC from C-Code"}, {NULL} /* Sentinel */ }; : static PyTypeObject PySDLXMLNodeType = { PyObject_HEAD_INIT(NULL) : }; //===================================================================/ // ::: output :::::::::::::::::::::::::::::::::::::::::::::::::::: cc ...135603272 t ...proof object-valid pointer?: 0x8165940 ...back to python... test.py Segmentation fault //===================================================================/ ...you see: It returns to python but over there the object is something bad. So what is wrong? -- http://mail.python.org/mailman/listinfo/python-list