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

No members online now.

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,782
Latest member
ThomasGex

Latest Threads

Top