looking for a debugging tip....

Mark Hammond mhammond at skippinet.com.au
Mon May 1 20:15:18 EDT 2000


"Gregory Trubetskoy" <grisha at ispol.com> wrote in message
news:Pine.LNX.4.21.0005011533010.2691-100000 at saturn.ispol.com...
>
> A question to C-API gurus:
>
> Program received signal SIGSEGV, Segmentation fault.
> PyObject_Hash (v=0x81c773f) at object.c:349
> 349 if (tp->tp_hash != NULL)
>
> If I at least knew what it is that Python is trying to do, e.g. the name
> of the object whose type seems to have dissapeared, I'd have a clue on
> what's going on.

There is an excellent chance that the "tp" object has a reference count
bug.  You extension/app is probably losing a reference, causing the object
to be freed while Python still holds a reference to it.  When Python gets
around to touching that reference, it dies.  Thus, it appears the bug is
not in your code - all it does is frees the object too early (which
succeeds) - its other code in the system that uses the object that _sees_
the bug!


> I saw that there is a Py_DEBUG value in the code - are there any
> instructions on how to use it? What is the best way to troubleshoot this
> sort of thing?

Py_DEBUG is fine, but probably wont help track this down much.  A C
debugger will :-)

Mark.






More information about the Python-list mailing list