[capi-sig] Segfault when using own C-written module and exiting python

Adam Olsen rhamph at gmail.com
Sat Jun 7 04:14:40 CEST 2008

On Fri, Jun 6, 2008 at 1:40 PM, Laurent Gautier <lgautier at gmail.com> wrote:
> I have probably found the problem. I report it here in case someone
> has the same issue later.
> In my tp_new I had:
> PyObject_New(MyType, type);
> (and it was working just fine until I started with subclasses)
> while it seems that it should have been:
> type->tp_alloc(type, 0);

Do you have Py_TPFLAGS_HAVE_GC set?  That'd require you to use
PyObject_GC_New, which'd allocate extra space for the tracking flag,
and the absence of which would explain the crash.

Adam Olsen, aka Rhamphoryncus

More information about the capi-sig mailing list