memory violation error

Ignacio Vazquez-Abrams ignacio at openservices.net
Thu Sep 13 15:09:03 CEST 2001


On Thu, 13 Sep 2001, Silvio Arcangeli wrote:

> When I call it from Python it raises a memory violation error. I'm quite
> sure that this problem it's caused by the API function, since if I comment
> out the line that calls it in the extension module the error is not raised.
> (The code of the function in the extension module is bug free for sure, it
> doesn't do anything else than calling PyArg_ParseTuple, the API function
> and then Py_BuildVaule.)
> The strange thing is  that the API function seems to work fine in C, the
> results are just the expected ones, and if I run the same code in a C
> application no such error happens. The memory violation error happens only
> when the function in the extension module is returning to the interpreter.
> What could be the cause?

Well, I'm guessing blind here, but I'd say it's because you borrow a reference
in the C-side and forget to increment its reference count, and in the
Python-side the reference disappers and so your C code is using an invalid
memory location.

-- 
Ignacio Vazquez-Abrams  <ignacio at openservices.net>





More information about the Python-list mailing list