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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209
|
/*[clinic input]
preserve
[clinic start generated code]*/
#include "pycore_modsupport.h" // _PyArg_CheckPositional()
PyDoc_STRVAR(_testcapi_pyobject_fastcalldict__doc__,
"pyobject_fastcalldict($module, func, func_args, kwargs, /)\n"
"--\n"
"\n");
#define _TESTCAPI_PYOBJECT_FASTCALLDICT_METHODDEF \
{"pyobject_fastcalldict", _PyCFunction_CAST(_testcapi_pyobject_fastcalldict), METH_FASTCALL, _testcapi_pyobject_fastcalldict__doc__},
static PyObject *
_testcapi_pyobject_fastcalldict_impl(PyObject *module, PyObject *func,
PyObject *func_args, PyObject *kwargs);
static PyObject *
_testcapi_pyobject_fastcalldict(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *func;
PyObject *func_args;
PyObject *__clinic_kwargs;
if (!_PyArg_CheckPositional("pyobject_fastcalldict", nargs, 3, 3)) {
goto exit;
}
func = args[0];
func_args = args[1];
__clinic_kwargs = args[2];
return_value = _testcapi_pyobject_fastcalldict_impl(module, func, func_args, __clinic_kwargs);
exit:
return return_value;
}
PyDoc_STRVAR(_testcapi_pyobject_vectorcall__doc__,
"pyobject_vectorcall($module, func, func_args, kwnames, /)\n"
"--\n"
"\n");
#define _TESTCAPI_PYOBJECT_VECTORCALL_METHODDEF \
{"pyobject_vectorcall", _PyCFunction_CAST(_testcapi_pyobject_vectorcall), METH_FASTCALL, _testcapi_pyobject_vectorcall__doc__},
static PyObject *
_testcapi_pyobject_vectorcall_impl(PyObject *module, PyObject *func,
PyObject *func_args, PyObject *kwnames);
static PyObject *
_testcapi_pyobject_vectorcall(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *func;
PyObject *func_args;
PyObject *__clinic_kwnames;
if (!_PyArg_CheckPositional("pyobject_vectorcall", nargs, 3, 3)) {
goto exit;
}
func = args[0];
func_args = args[1];
__clinic_kwnames = args[2];
return_value = _testcapi_pyobject_vectorcall_impl(module, func, func_args, __clinic_kwnames);
exit:
return return_value;
}
PyDoc_STRVAR(_testcapi_pyvectorcall_call__doc__,
"pyvectorcall_call($module, func, argstuple, kwargs=<unrepresentable>, /)\n"
"--\n"
"\n");
#define _TESTCAPI_PYVECTORCALL_CALL_METHODDEF \
{"pyvectorcall_call", _PyCFunction_CAST(_testcapi_pyvectorcall_call), METH_FASTCALL, _testcapi_pyvectorcall_call__doc__},
static PyObject *
_testcapi_pyvectorcall_call_impl(PyObject *module, PyObject *func,
PyObject *argstuple, PyObject *kwargs);
static PyObject *
_testcapi_pyvectorcall_call(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *func;
PyObject *argstuple;
PyObject *__clinic_kwargs = NULL;
if (!_PyArg_CheckPositional("pyvectorcall_call", nargs, 2, 3)) {
goto exit;
}
func = args[0];
argstuple = args[1];
if (nargs < 3) {
goto skip_optional;
}
__clinic_kwargs = args[2];
skip_optional:
return_value = _testcapi_pyvectorcall_call_impl(module, func, argstuple, __clinic_kwargs);
exit:
return return_value;
}
PyDoc_STRVAR(_testcapi_VectorCallClass_set_vectorcall__doc__,
"set_vectorcall($self, type, /)\n"
"--\n"
"\n"
"Set self\'s vectorcall function for `type` to one that returns \"vectorcall\"");
#define _TESTCAPI_VECTORCALLCLASS_SET_VECTORCALL_METHODDEF \
{"set_vectorcall", (PyCFunction)_testcapi_VectorCallClass_set_vectorcall, METH_O, _testcapi_VectorCallClass_set_vectorcall__doc__},
static PyObject *
_testcapi_VectorCallClass_set_vectorcall_impl(PyObject *self,
PyTypeObject *type);
static PyObject *
_testcapi_VectorCallClass_set_vectorcall(PyObject *self, PyObject *arg)
{
PyObject *return_value = NULL;
PyTypeObject *type;
if (!PyObject_TypeCheck(arg, &PyType_Type)) {
_PyArg_BadArgument("set_vectorcall", "argument", (&PyType_Type)->tp_name, arg);
goto exit;
}
type = (PyTypeObject *)arg;
return_value = _testcapi_VectorCallClass_set_vectorcall_impl(self, type);
exit:
return return_value;
}
PyDoc_STRVAR(_testcapi_make_vectorcall_class__doc__,
"make_vectorcall_class($module, base=<unrepresentable>, /)\n"
"--\n"
"\n"
"Create a class whose instances return \"tpcall\" when called.\n"
"\n"
"When the \"set_vectorcall\" method is called on an instance, a vectorcall\n"
"function that returns \"vectorcall\" will be installed.");
#define _TESTCAPI_MAKE_VECTORCALL_CLASS_METHODDEF \
{"make_vectorcall_class", _PyCFunction_CAST(_testcapi_make_vectorcall_class), METH_FASTCALL, _testcapi_make_vectorcall_class__doc__},
static PyObject *
_testcapi_make_vectorcall_class_impl(PyObject *module, PyTypeObject *base);
static PyObject *
_testcapi_make_vectorcall_class(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyTypeObject *base = NULL;
if (!_PyArg_CheckPositional("make_vectorcall_class", nargs, 0, 1)) {
goto exit;
}
if (nargs < 1) {
goto skip_optional;
}
if (!PyObject_TypeCheck(args[0], &PyType_Type)) {
_PyArg_BadArgument("make_vectorcall_class", "argument 1", (&PyType_Type)->tp_name, args[0]);
goto exit;
}
base = (PyTypeObject *)args[0];
skip_optional:
return_value = _testcapi_make_vectorcall_class_impl(module, base);
exit:
return return_value;
}
PyDoc_STRVAR(_testcapi_has_vectorcall_flag__doc__,
"has_vectorcall_flag($module, type, /)\n"
"--\n"
"\n"
"Return true iff Py_TPFLAGS_HAVE_VECTORCALL is set on the class.");
#define _TESTCAPI_HAS_VECTORCALL_FLAG_METHODDEF \
{"has_vectorcall_flag", (PyCFunction)_testcapi_has_vectorcall_flag, METH_O, _testcapi_has_vectorcall_flag__doc__},
static int
_testcapi_has_vectorcall_flag_impl(PyObject *module, PyTypeObject *type);
static PyObject *
_testcapi_has_vectorcall_flag(PyObject *module, PyObject *arg)
{
PyObject *return_value = NULL;
PyTypeObject *type;
int _return_value;
if (!PyObject_TypeCheck(arg, &PyType_Type)) {
_PyArg_BadArgument("has_vectorcall_flag", "argument", (&PyType_Type)->tp_name, arg);
goto exit;
}
type = (PyTypeObject *)arg;
_return_value = _testcapi_has_vectorcall_flag_impl(module, type);
if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
}
return_value = PyBool_FromLong((long)_return_value);
exit:
return return_value;
}
/*[clinic end generated code: output=210ae67caab177ba input=a9049054013a1b77]*/
|