diff options
| author | Filipe Laíns <lains@riseup.net> | 2024-11-22 23:13:43 +0000 |
|---|---|---|
| committer | Jussi Pakkanen <jussi.pakkanen@mailbox.org> | 2025-08-28 22:09:20 +0300 |
| commit | 59c3dd1fdf1677e3754449314337277083327b03 (patch) | |
| tree | 200e389f02d1b37e0f2eccd1987650edf029534c /test cases/unit | |
| parent | e38545b00061dafddd601a1959946ab3a531ba13 (diff) | |
| download | meson-59c3dd1fdf1677e3754449314337277083327b03.tar.gz | |
python: add a python.build_config option (PEP 739)
Signed-off-by: Filipe Laíns <lains@riseup.net>
Signed-off-by: Michał Górny <mgorny@quansight.com>
Diffstat (limited to 'test cases/unit')
| -rw-r--r-- | test cases/unit/125 python extension/foo.c | 31 | ||||
| -rw-r--r-- | test cases/unit/125 python extension/meson.build | 20 |
2 files changed, 51 insertions, 0 deletions
diff --git a/test cases/unit/125 python extension/foo.c b/test cases/unit/125 python extension/foo.c new file mode 100644 index 000000000..e1a0dfb7b --- /dev/null +++ b/test cases/unit/125 python extension/foo.c @@ -0,0 +1,31 @@ +#define PY_SSIZE_T_CLEAN +#include <Python.h> + + +static PyObject * +bar_impl(PyObject *self, PyObject *args) +{ + return Py_None; +} + + +static PyMethodDef foo_methods[] = { + {"bar", bar_impl, METH_NOARGS, NULL}, + {NULL, NULL, 0, NULL} /* sentinel */ +}; + + +static struct PyModuleDef foo_module = { + PyModuleDef_HEAD_INIT, + "foo", /* m_name */ + NULL, /* m_doc */ + -1, /* m_size */ + foo_methods, /* m_methods */ +}; + + +PyMODINIT_FUNC +PyInit_foo(void) +{ + return PyModule_Create(&foo_module); +} diff --git a/test cases/unit/125 python extension/meson.build b/test cases/unit/125 python extension/meson.build new file mode 100644 index 000000000..8cebceab7 --- /dev/null +++ b/test cases/unit/125 python extension/meson.build @@ -0,0 +1,20 @@ +project('python extension', 'c', meson_version : '>=1.3.0') + +py = import('python').find_installation('') + +py.extension_module( + 'foo', 'foo.c', + install: true, +) + +limited_api_supported = true +if py.language_version().version_compare('>=3.13') and py.language_version().version_compare('<3.15') + limited_api_supported = py.get_variable('Py_GIL_DISABLED') != 1 +endif +if limited_api_supported + py.extension_module( + 'foo_stable', 'foo.c', + install: true, + limited_api: '3.2', + ) +endif |
