C Extension Seg Faults

Paul Rubin http
Tue Jul 10 14:17:46 EDT 2007

Daryl <rts.cts at gmail.com> writes:
> The inner loop runs a few hundred times (263) then fails with a
> segmentation fault.  I've trolled through the documentation online and
> in the various .h files but can't seem to find anything.
> Anybody have an idea what really obvious foolish thing I'm doing?

It's not worth staring at code to try to figure out things like that.
Run it under gdb, examine the relevant data objects when it crashes
and see what's broken (e.g. some pointer is unexpectedly null), then
set a conditional breakpoint that stops execution when that incorrect
condition happens (e.g. the pointer gets set to null), run the program
til the breakpoint triggers, see what other condition X caused the
condition that caused the crash, set another breakpoint that triggers
when X occurs, etc.  Work backwards systematically til you find the bug.

More information about the Python-list mailing list