Fatal Python error: deallocating None
Fredrik Lundh
fredrik at pythonware.com
Thu Oct 26 03:29:47 EDT 2006
Gabriel Genellina wrote:
> Mmm, it appears that one of these C extensions isn't managing the ref
> count correctly - perhaps there is a return Py_None without a previous
> Py_INCREF? If None were returned in certain functions to indicate
> failure or something exceptional - and not a regular condition - that
> would explain that it doesn't fail very often.
> Unfortunately I don't know how to debug this - except by carefully
> inspecting the C code :(
inserting
print sys.getrefcount(None)
at strategic locations in your code will usually help you identify the
culprit.
(last time I stumbled upon this was in an earlier release of "sqlite",
which leaked one Py_None every time you connected to the database. our
application contained a separate task that created it's own database
connection every 15:th minute or so, to calculate some statistics. and
a fresh Python interpreter contains 500-600 references to Py_None...)
</F>
More information about the Python-list
mailing list