diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_testcapimodule.c | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index 5083be6..9378317 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -1103,6 +1103,63 @@ test_k_code(PyObject *self) } static PyObject * +getargs_f(PyObject *self, PyObject *args) +{ + float f; + if (!PyArg_ParseTuple(args, "f", &f)) + return NULL; + return PyFloat_FromDouble(f); +} + +static PyObject * +getargs_d(PyObject *self, PyObject *args) +{ + double d; + if (!PyArg_ParseTuple(args, "d", &d)) + return NULL; + return PyFloat_FromDouble(d); +} + +static PyObject * +getargs_D(PyObject *self, PyObject *args) +{ + Py_complex cval; + if (!PyArg_ParseTuple(args, "D", &cval)) + return NULL; + return PyComplex_FromCComplex(cval); +} + +static PyObject * +getargs_S(PyObject *self, PyObject *args) +{ + PyObject *obj; + if (!PyArg_ParseTuple(args, "S", &obj)) + return NULL; + Py_INCREF(obj); + return obj; +} + +static PyObject * +getargs_Y(PyObject *self, PyObject *args) +{ + PyObject *obj; + if (!PyArg_ParseTuple(args, "Y", &obj)) + return NULL; + Py_INCREF(obj); + return obj; +} + +static PyObject * +getargs_U(PyObject *self, PyObject *args) +{ + PyObject *obj; + if (!PyArg_ParseTuple(args, "U", &obj)) + return NULL; + Py_INCREF(obj); + return obj; +} + +static PyObject * getargs_c(PyObject *self, PyObject *args) { char c; @@ -3829,6 +3886,12 @@ static PyMethodDef TestMethods[] = { (PyCFunction)test_long_long_and_overflow, METH_NOARGS}, {"test_L_code", (PyCFunction)test_L_code, METH_NOARGS}, #endif + {"getargs_f", getargs_f, METH_VARARGS}, + {"getargs_d", getargs_d, METH_VARARGS}, + {"getargs_D", getargs_D, METH_VARARGS}, + {"getargs_S", getargs_S, METH_VARARGS}, + {"getargs_Y", getargs_Y, METH_VARARGS}, + {"getargs_U", getargs_U, METH_VARARGS}, {"getargs_c", getargs_c, METH_VARARGS}, {"getargs_C", getargs_C, METH_VARARGS}, {"getargs_s", getargs_s, METH_VARARGS}, |