cpython/Tools/modulator/Templates/module_tail

38 lines
787 B
Plaintext
Raw Normal View History

1995-03-02 10:05:29 -04:00
/* List of methods defined in the module */
static struct PyMethodDef $abbrev$_methods[] = {
$methodlist$
{NULL, NULL} /* sentinel */
1995-03-02 10:05:29 -04:00
};
/* Initialization function for the module (*must* be called init$name$) */
static char $name$_module_documentation[] =
""
;
1995-03-02 10:05:29 -04:00
void
init$name$()
{
PyObject *m, *d;
1995-03-02 10:05:29 -04:00
/* Create the module and add the functions */
m = Py_InitModule4("$name$", $abbrev$_methods,
$name$_module_documentation,
(PyObject*)NULL,PYTHON_API_VERSION);
1995-03-02 10:05:29 -04:00
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyString_FromString("$name$.error");
PyDict_SetItemString(d, "error", ErrorObject);
1995-03-02 10:05:29 -04:00
/* XXXX Add constants here */
/* Check for errors */
if (PyErr_Occurred())
Py_FatalError("can't initialize module $name$");
1995-03-02 10:05:29 -04:00
}