/* Initialization function for the module (*must* be called init$name$) */
+static char $name$_module_documentation[] =
+""
+;
+
void
init$name$()
{
PyObject *m, *d;
/* Create the module and add the functions */
- m = Py_InitModule("$name$", $abbrev$_methods);
+ m = Py_InitModule4("$name$", $abbrev$_methods,
+ $name$_module_documentation,
+ (PyObject*)NULL,PYTHON_API_VERSION);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
+static char $Abbrev$type__doc__[] =
+""
+;
+
static PyTypeObject $Abbrev$type = {
PyObject_HEAD_INIT(&PyType_Type)
0, /*ob_size*/
$tp_as_sequence$, /*tp_as_sequence*/
$tp_as_mapping$, /*tp_as_mapping*/
(hashfunc)$tp_hash$, /*tp_hash*/
+ (binaryfunc)$tp_call$, /*tp_call*/
+ (reprfunc)$tp_str$, /*tp_str*/
+
+ /* Space for future expansion */
+ 0L,0L,0L,0L,
+ $Abbrev$type__doc__ /* Documentation string */
};
/* End of code for $name$ objects */
# Names of functions in the object-description struct.
#
FUNCLIST = ['new', 'tp_dealloc', 'tp_print', 'tp_getattr', 'tp_setattr',
- 'tp_compare', 'tp_repr', 'tp_hash']
+ 'tp_compare', 'tp_repr', 'tp_hash', 'tp_call', 'tp_str']
TYPELIST = ['tp_as_number', 'tp_as_sequence', 'tp_as_mapping', 'structure']
#
for fn in self.methodlist:
self.method = fn
self.addcode('module_method', fp)
- new_ml = new_ml + ('{"%s",\t%s_%s,\t1},\n'%(fn, self.abbrev, fn))
+ new_ml = new_ml + ('{"%s",\t%s_%s,\t1,\t%s_%s__doc__},\n'
+ %(fn, self.abbrev, fn, self.abbrev, fn))
self.methodlist = new_ml
self.addcode('module_tail', fp)
for fn in self.methodlist:
self.method = fn
self.addcode('object_method', fp)
- new_ml = new_ml + ('{"%s",\t%s_%s,\t1},\n'%(fn, self.abbrev, fn))
+ new_ml = new_ml + ('{"%s",\t%s_%s,\t1,\t%s_%s__doc__},\n'
+ %(fn, self.abbrev, fn, self.abbrev, fn))
self.methodlist = new_ml
self.addcode('object_mlist', fp)