segfault in extension module

Miki Tebeka mikit at zoran.co.il
Mon Dec 1 09:17:51 CET 2003


Hello Nat,

> I've written a function in C to perform protein sequence alignment.  This
> works fine in a standalone C program.  I've added the necessary packaging
> to use it in Python; 
Which one? Are you using the C API?

> it returns three strings and an integer.  However, as
> soon as the function is complete, I get a segfault and the interpreter
> dies.
Looks like refcount problems, check out
http://www.python.org/doc/current/ext/refcounts.html .

IMO just avoid all this stuff and use SWIG/Boost.Python/Pyrex.

HTH.
Miki




More information about the Python-list mailing list