| 1 |
#include <Python.h> |
| 2 |
|
| 3 |
|
| 4 |
static PyMethodDef TestextMethods[] = { |
| 5 |
{NULL, NULL, 0, NULL} |
| 6 |
}; |
| 7 |
|
| 8 |
|
| 9 |
#if PY_MAJOR_VERSION >=3 |
| 10 |
static struct PyModuleDef testextmodule = { |
| 11 |
PyModuleDef_HEAD_INIT, /* This should correspond to a PyModuleDef_Base type */ |
| 12 |
"testext", /* This is the module name */ |
| 13 |
"Test extension module", /* This is the module docstring */ |
| 14 |
-1, /* This defines the size of the module and says everything is global */ |
| 15 |
TestextMethods /* This is the method definition */ |
| 16 |
}; |
| 17 |
|
| 18 |
PyObject* |
| 19 |
PyInit_testext(void) |
| 20 |
{ |
| 21 |
return PyModule_Create(&testextmodule); |
| 22 |
} |
| 23 |
#else |
| 24 |
PyMODINIT_FUNC |
| 25 |
inittestext(void) |
| 26 |
{ |
| 27 |
Py_InitModule("testext", TestextMethods); |
| 28 |
} |
| 29 |
#endif |