[capi-sig] Subclassing extension types - sorry

Joost joost at h-labahn.de
Tue Nov 17 00:21:40 CET 2009


another cry for help i can withdraw.

Yes, it was line 380 in

378 PyObject *Button_new(PyTypeObject *type,
			PyObject *args,
			PyObject *kwds) {\
379	Button *self;\
380	self = (Button *)Pikt_new(&Button_Type, args, kwds); \
381	self->Q.gobj = PyCapsule_New(newfunc, "Button", NULL); \
382	if (! self->Q.gobj)
		{ Py_DECREF(self); KTERR("Cannot create Button");};\
383	return (PyObject *)self;\

(newfunc came - as the backslashes - from the original
preprocessor macro (the second argument), where i had filled
Button in for the first argument). With the normal

self = (Button *)type->tp_alloc(type, 0)

things work now. Still not all is fine, but now these
widgets can be subclassed. Unfortunately i cannot remember
exactly, what lines in what part of the tutorial or
references (or a comment in the sources ?) brought me to the
idea to need the wrong code as above.

Thanks for reading, Joost

More information about the capi-sig mailing list