access violation with C API

C

cptnwillard

Hello all,

The following triggers an "access violation" error, why?

pPyType = (PyTypeObject*)malloc(sizeof(PyTypeObject));
memset(pPyType, 0, sizeof(PyTypeObject));
pPyType->ob_refcnt = 1;
pPyType->tp_name = "noname";
pPyType->tp_basicsize = sizeof(MyObject);
pPyType->tp_flags = Py_TPFLAGS_DEFAULT;
pPyType->tp_doc = "nodoc";
PyType_Ready(pPyType);

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top