[C-API] Weird sys.exc_info reference segfault

Antoine Pitrou solipsis at pitrou.net
Mon Oct 4 23:41:30 CEST 2010


On Mon, 04 Oct 2010 23:30:58 +0200
"Jonas H." <jonas at lophus.org> wrote:
> 
> > [...] here's a minimal, but __complete__, module that defines a new type:
> >
> > [...]
> > static PyTypeObject noddy_NoddyType = {
> >     [...]
> >     0,                         /*tp_dealloc*/
> >     [...]
> > };
> 
> So I thought "complete" meant "it works". Actually, DECREFing that an 
> object of *that* type does not work, it crashes because of the NULL 
> `tp_dealloc` function pointer that is called in `_Py_Dealloc`.

Well, it should work, but you have to call PyType_Ready() to fill in
the NULL fields with default values (for those where it's necessary).
Does it solve it for you?

Regards

Antoine.





More information about the Python-list mailing list