"Memory could not be Read/Written" crashes with C extension DLL... HELP PLEASE!

Kevin Cazabon kevin at cazabon.com
Sat Apr 6 13:49:24 EST 2002


Through some help, I've found that this section is causing the
problem... If I simply use "return Py_BuildValue("lllO", pp1,
inBufferSize, pp3, inBuffer);", it works fine with no crashes.

What is the difference though, shouldn't the code below work too?  Is
there maybe something wrong in the PyTuple code?  (As mentioned
before, it only crashed when called multiple times (40+ usually), but
worked fine otherwise.

Kevin.

>   // build pp1, inBufferSize, pp3 into PyObjects for returning
>   pLong1 = PyLong_FromLong(pp1);
>   pLong2 = PyLong_FromLong(inBufferSize);
>   pLong3 = PyLong_FromLong(pp3);
> 
>   // build pLong1, pLong2, pLong3, pString into a tuple to return
> 
>   pReturn = PyTuple_New(4);
>   PyTuple_SetItem(pReturn, 0, pLong1); 
>   PyTuple_SetItem(pReturn, 1, pLong2);
>   PyTuple_SetItem(pReturn, 2, pLong3);
>   PyTuple_SetItem(pReturn, 3, inBuffer);
> 
>   return pReturn;
> }



More information about the Python-list mailing list