diff options
author | Victor Stinner <vstinner@python.org> | 2023-06-01 09:25:55 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-01 09:25:55 (GMT) |
commit | 27f9491c60606460209c109fc8ad8a6dcfd02f79 (patch) | |
tree | d940076311f27f2a07a11bf23a8fd6ceaa4c27f2 /Modules | |
parent | 7f5afecfd74de7f2fbd6b0cc0cc58b12bb608a19 (diff) | |
download | cpython-27f9491c60606460209c109fc8ad8a6dcfd02f79.zip cpython-27f9491c60606460209c109fc8ad8a6dcfd02f79.tar.gz cpython-27f9491c60606460209c109fc8ad8a6dcfd02f79.tar.bz2 |
gh-105107: Remove PyCFunction_Call() function (#105181)
* Keep the function in the stable ABI.
* Add unit tests on PyCFunction_Call() since it remains supported in
the stable ABI.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_testcapimodule.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index 86b6dc3..d7c89f4 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -2363,6 +2363,19 @@ meth_fastcall_keywords(PyObject* self, PyObject* const* args, } static PyObject* +test_pycfunction_call(PyObject *module, PyObject *args) +{ + // Function removed in the Python 3.13 API but was kept in the stable ABI. + extern PyObject* PyCFunction_Call(PyObject *callable, PyObject *args, PyObject *kwargs); + + PyObject *func, *pos_args, *kwargs = NULL; + if (!PyArg_ParseTuple(args, "OO!|O!", &func, &PyTuple_Type, &pos_args, &PyDict_Type, &kwargs)) { + return NULL; + } + return PyCFunction_Call(func, pos_args, kwargs); +} + +static PyObject* pynumber_tobase(PyObject *module, PyObject *args) { PyObject *obj; @@ -3369,6 +3382,7 @@ static PyMethodDef TestMethods[] = { {"meth_noargs", meth_noargs, METH_NOARGS}, {"meth_fastcall", _PyCFunction_CAST(meth_fastcall), METH_FASTCALL}, {"meth_fastcall_keywords", _PyCFunction_CAST(meth_fastcall_keywords), METH_FASTCALL|METH_KEYWORDS}, + {"pycfunction_call", test_pycfunction_call, METH_VARARGS}, {"pynumber_tobase", pynumber_tobase, METH_VARARGS}, {"test_set_type_size", test_set_type_size, METH_NOARGS}, {"test_py_clear", test_py_clear, METH_NOARGS}, |