seg. fault with ext. module

Gorny gorny at hobbiton.org
Sat Aug 25 12:56:08 EDT 2001


> Yes (sort of). The function returns a reference to an existing object
> without updating the ref count. The caller (the Interpreter) will
> decrement the ref count, when this reference gets out of scope,
> which means in this case `None' is disposed too early, because it was
> used more often than the ref count said. (Someone with more insight
> can explain why this creates a segfault.)

;-) allright, I got the point.. thanks

> Yes. If you return a reference to an existing object, you have to
> increment the ref count. If you create a new object (e.g. with
> Py_BuildValue()), you just pass the reference to the caller.
>
> /steffen

thanks again

Gorny


--
"When I was a little kid, I had this dream where a snake would rule and
dominate
the entire world (actually, I guess that a penguin was also part of the
dream...
but never mind)" -- Python Develper's Handbook, Andre Lessa
http://gorny.cjb.net






More information about the Python-list mailing list