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