How to find who is decref'ing Py_None on me!

Tim Peters tim_one at email.msn.com
Fri Aug 11 15:23:23 EDT 2000


[posted & mailed]

[Warren Postma]
> (It's got to be Me, of course, but where in the C sources...)
>
> I have an embedded/extended Python App in which the reference
> counts on Py_None are creeping towards zero during program run,
> and I'd like to find which DECREFs are causing it. ...

FWIW, it's almost certainly *not* the case that someone is decref'ing
Py_None when they shouldn't, so looking at DECREFs is likely to give you an
excruciatingly long tour of correctly-working code.  Far more likely is that
one of your functions is returning Py_None but neglecting to INCREF it
first.  In which case, there's no need to look at the Python implementation
at all:  look at the return paths in your own code.

occam's-refcount-razor-ly y'rs  - tim






More information about the Python-list mailing list