segfault in extension module

Michael Hudson mwh at python.net
Mon Dec 1 19:45:28 CET 2003


Nathaniel Echols <echols at OCF.Berkeley.EDU> writes:

> > Looks like refcount problems, check out
> > http://www.python.org/doc/current/ext/refcounts.html .
> 
> I read this before and couldn't figure out what it meant.

Then I am pretty sure this is your problem :-)

> This does seem like it would relate, but I can't figure out what I'm
> doing incorrectly.  I just have one function which calls a pure C
> function and returns a tuple of strings from it.  I'm guessing I
> need to add a Py_INCREF() somewhere but so far this just makes it
> segfault sooner.  (I'm not sure what argument to use for
> Py_INCREF(), either.)
> 
> I've looked at several other pages, and they all seem to involve setups
> more complicated than what I'm doing.  I'm already using Py_BuildValue()
> to generate the returned tuple, and my understanding is that this should
> avoid major problems. . .

Post some code.

Cheers,
mwh

-- 
  If Unicode is a horde of zombies with flaming dung sticks, 
  the hideous intricacies of JIS, Chinese Big-5, Chinese 
  Traditional, KOI-8, et cetera are at least an army of ogres 
  with salt and flensing knives.        -- Eric S. Raymond, python-dev




More information about the Python-list mailing list