problem with Py_BuildValue

Christian Meesters meesters at uni-mainz.de
Sun Jun 15 12:52:20 EDT 2008


Thank you so much - I was such an idiot (see below).

>>> I see nothing wrong with your code so I'd say it is somewhere else (did
>>> you snip any code between the end of the loop and the return?).
> 
>>No. (Apart from freeing allocated memory.)
> 
> I'm pretty sure we'll find something interesting here :)
Still not. I was about to prove it and already uploaded the file, when I
saw, what was really going wrong ...
> 
> PyList_GetItem returns a borrowed reference so you shoud _not_ unref it
> (this explains the refcnt -1 I think)
This is THE crucial point. If I just delete the Py_CLEAR-line, everything is
working smoothly and calling PyFloat_FromDouble-is working too.

Again: Thanks a lot. 'Reference counting' won't become one of my
hobbies ;-).

Best,
Christian



More information about the Python-list mailing list