3 staticforward PyTypeObject noddy_NoddyType
;
7 /* Type-specific fields go here. */
11 noddy_new_noddy(PyObject
* self
, PyObject
* args
)
13 noddy_NoddyObject
* noddy
;
15 noddy
= PyObject_New(noddy_NoddyObject
, &noddy_NoddyType
);
17 /* Initialize type-specific fields here. */
19 return (PyObject
*)noddy
;
23 noddy_noddy_dealloc(PyObject
* self
)
25 /* Free any external resources here;
26 * if the instance owns references to any Python
27 * objects, call Py_DECREF() on them here.
32 statichere PyTypeObject noddy_NoddyType
= {
33 PyObject_HEAD_INIT(NULL
)
36 sizeof(noddy_NoddyObject
),
38 noddy_noddy_dealloc
, /*tp_dealloc*/
50 static PyMethodDef noddy_methods
[] = {
51 {"new_noddy", noddy_new_noddy
, METH_NOARGS
,
52 "Create a new Noddy object."},
60 noddy_NoddyType
.ob_type
= &PyType_Type
;
61 if (PyType_Ready(&noddy_NoddyType
))
64 Py_InitModule3("noddy", noddy_methods
65 "Example module that creates an extension type.");