diff options
| author | Andrew McNulty <amcn102@gmail.com> | 2024-05-08 14:51:25 +0200 |
|---|---|---|
| committer | Andrew McNulty <amcn102@gmail.com> | 2024-06-11 19:47:31 +0200 |
| commit | d1abdce88fa263b6e532901564e44ca510df1065 (patch) | |
| tree | 30e7de1076b4fd147c0b2d8bec666ed0f5aebdba /test cases/python/9 extmodule limited api/limited.c | |
| parent | 141100e482e440dd08ea8b5b042927cac968f112 (diff) | |
| download | meson-d1abdce88fa263b6e532901564e44ca510df1065.tar.gz | |
Python: add load test to limited API test
Based on the example in GH issue #13167, the limited API test has been
extended with a test to load the compiled module to ensure it can be
loaded correctly.
Diffstat (limited to 'test cases/python/9 extmodule limited api/limited.c')
| -rw-r--r-- | test cases/python/9 extmodule limited api/limited.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/test cases/python/9 extmodule limited api/limited.c b/test cases/python/9 extmodule limited api/limited.c index 0d1c71820..b977419ca 100644 --- a/test cases/python/9 extmodule limited api/limited.c +++ b/test cases/python/9 extmodule limited api/limited.c @@ -6,12 +6,22 @@ #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_api_test", + "limited", NULL, -1, - NULL + methods }; PyMODINIT_FUNC PyInit_limited(void) { |
