Please explain the meaning of 'stealing' a ref

Christos TZOTZIOY Georgiou tzot at sil-tec.gr
Mon Nov 3 20:30:43 EST 2003


I invested some time today because I got this crazy idea that if I
implemented a simple attribute-getting caching scheme implemented in
PyObject_GetAttr / PyObject_SetAttr that would turn out to be good.

So I did implement one touching Objects/object.c (and pythonrun.c for
init/final purposes), and I got a 5% increase in pystone... of course,
when I exited the interpreter, I got a nice segfault :-)  Also,
test.testall segfaulted at test_anydbm.  I didn't expect anything
better, to be honest; it's obviously got something to do with inc/dec
refs.

Now I'm googling for the various debug building options (I'm not sure
that -DDEBUG is enough etc), however I realised it's time to ask what I
never understood so far: what exactly is the meaning of a function
"stealing a reference"?  Is it that the function does an incref or a
decref?  Or is it something more obscure?

TIA for any answers.

PS Do we have still time to help Guido be the one that throws the pie?-)
-- 
TZOTZIOY, I speak England very best,
Ils sont fous ces Redmontains! --Harddix




More information about the Python-list mailing list