| 1 |
#include <Python.h> |
| 2 |
|
| 3 |
#ifndef Py_LIMITED_API |
| 4 |
#error Py_LIMITED_API must be defined. |
| 5 |
#elif Py_LIMITED_API != 0x03070000 |
| 6 |
#error Wrong value for Py_LIMITED_API |
| 7 |
#endif |
| 8 |
|
| 9 |
static PyObject * |
| 10 |
hello(PyObject * Py_UNUSED(self), PyObject * Py_UNUSED(args)) { |
| 11 |
return PyUnicode_FromString("hello world"); |
| 12 |
} |
| 13 |
|
| 14 |
static struct PyMethodDef methods[] = { |
| 15 |
{ "hello", hello, METH_NOARGS, NULL }, |
| 16 |
{ NULL, NULL, 0, NULL }, |
| 17 |
}; |
| 18 |
|
| 19 |
static struct PyModuleDef limited_module = { |
| 20 |
PyModuleDef_HEAD_INIT, |
| 21 |
"limited", |
| 22 |
NULL, |
| 23 |
-1, |
| 24 |
methods |
| 25 |
}; |
| 26 |
|
| 27 |
PyMODINIT_FUNC PyInit_limited(void) { |
| 28 |
return PyModule_Create(&limited_module); |
| 29 |
} |