0
0
mirror of https://github.com/python/cpython.git synced 2024-11-27 23:47:29 +01:00
cpython/Modules/_testcapi/clinic/watchers.c.h
Victor Stinner be5e8a0103
gh-110964: Remove private _PyArg functions (#110966)
Move the following private functions and structures to
pycore_modsupport.h internal C API:

* _PyArg_BadArgument()
* _PyArg_CheckPositional()
* _PyArg_NoKeywords()
* _PyArg_NoPositional()
* _PyArg_ParseStack()
* _PyArg_ParseStackAndKeywords()
* _PyArg_Parser structure
* _PyArg_UnpackKeywords()
* _PyArg_UnpackKeywordsWithVararg()
* _PyArg_UnpackStack()
* _Py_ANY_VARARGS()

Changes:

* Python/getargs.h now includes pycore_modsupport.h to export
  functions.
* clinic.py now adds pycore_modsupport.h when one of these functions
  is used.
* Add pycore_modsupport.h includes when a C extension uses one of
  these functions.
* Define Py_BUILD_CORE_MODULE in C extensions which now include
  directly or indirectly (via code generated by Argument Clinic)
  pycore_modsupport.h:

  * _csv
  * _curses_panel
  * _dbm
  * _gdbm
  * _multiprocessing.posixshmem
  * _sqlite.row
  * _statistics
  * grp
  * resource
  * syslog

* _testcapi: bad_get() no longer uses METH_FASTCALL calling
  convention but METH_VARARGS. Replace _PyArg_UnpackStack() with
  PyArg_ParseTuple().
* _testcapi: add PYTESTCAPI_NEED_INTERNAL_API macro which is defined
  by _testcapi sub-modules which need the internal C API
  (pycore_modsupport.h): exceptions.c, float.c, vectorcall.c,
  watchers.c.
* Remove Include/cpython/modsupport.h header file.
  Include/modsupport.h no longer includes the removed header file.
* Fix mypy clinic.py
2023-10-17 14:30:31 +02:00

195 lines
5.5 KiB
C
Generated

/*[clinic input]
preserve
[clinic start generated code]*/
#include "pycore_modsupport.h" // _PyArg_CheckPositional()
PyDoc_STRVAR(_testcapi_watch_dict__doc__,
"watch_dict($module, watcher_id, dict, /)\n"
"--\n"
"\n");
#define _TESTCAPI_WATCH_DICT_METHODDEF \
{"watch_dict", _PyCFunction_CAST(_testcapi_watch_dict), METH_FASTCALL, _testcapi_watch_dict__doc__},
static PyObject *
_testcapi_watch_dict_impl(PyObject *module, int watcher_id, PyObject *dict);
static PyObject *
_testcapi_watch_dict(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
int watcher_id;
PyObject *dict;
if (!_PyArg_CheckPositional("watch_dict", nargs, 2, 2)) {
goto exit;
}
watcher_id = PyLong_AsInt(args[0]);
if (watcher_id == -1 && PyErr_Occurred()) {
goto exit;
}
dict = args[1];
return_value = _testcapi_watch_dict_impl(module, watcher_id, dict);
exit:
return return_value;
}
PyDoc_STRVAR(_testcapi_unwatch_dict__doc__,
"unwatch_dict($module, watcher_id, dict, /)\n"
"--\n"
"\n");
#define _TESTCAPI_UNWATCH_DICT_METHODDEF \
{"unwatch_dict", _PyCFunction_CAST(_testcapi_unwatch_dict), METH_FASTCALL, _testcapi_unwatch_dict__doc__},
static PyObject *
_testcapi_unwatch_dict_impl(PyObject *module, int watcher_id, PyObject *dict);
static PyObject *
_testcapi_unwatch_dict(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
int watcher_id;
PyObject *dict;
if (!_PyArg_CheckPositional("unwatch_dict", nargs, 2, 2)) {
goto exit;
}
watcher_id = PyLong_AsInt(args[0]);
if (watcher_id == -1 && PyErr_Occurred()) {
goto exit;
}
dict = args[1];
return_value = _testcapi_unwatch_dict_impl(module, watcher_id, dict);
exit:
return return_value;
}
PyDoc_STRVAR(_testcapi_watch_type__doc__,
"watch_type($module, watcher_id, type, /)\n"
"--\n"
"\n");
#define _TESTCAPI_WATCH_TYPE_METHODDEF \
{"watch_type", _PyCFunction_CAST(_testcapi_watch_type), METH_FASTCALL, _testcapi_watch_type__doc__},
static PyObject *
_testcapi_watch_type_impl(PyObject *module, int watcher_id, PyObject *type);
static PyObject *
_testcapi_watch_type(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
int watcher_id;
PyObject *type;
if (!_PyArg_CheckPositional("watch_type", nargs, 2, 2)) {
goto exit;
}
watcher_id = PyLong_AsInt(args[0]);
if (watcher_id == -1 && PyErr_Occurred()) {
goto exit;
}
type = args[1];
return_value = _testcapi_watch_type_impl(module, watcher_id, type);
exit:
return return_value;
}
PyDoc_STRVAR(_testcapi_unwatch_type__doc__,
"unwatch_type($module, watcher_id, type, /)\n"
"--\n"
"\n");
#define _TESTCAPI_UNWATCH_TYPE_METHODDEF \
{"unwatch_type", _PyCFunction_CAST(_testcapi_unwatch_type), METH_FASTCALL, _testcapi_unwatch_type__doc__},
static PyObject *
_testcapi_unwatch_type_impl(PyObject *module, int watcher_id, PyObject *type);
static PyObject *
_testcapi_unwatch_type(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
int watcher_id;
PyObject *type;
if (!_PyArg_CheckPositional("unwatch_type", nargs, 2, 2)) {
goto exit;
}
watcher_id = PyLong_AsInt(args[0]);
if (watcher_id == -1 && PyErr_Occurred()) {
goto exit;
}
type = args[1];
return_value = _testcapi_unwatch_type_impl(module, watcher_id, type);
exit:
return return_value;
}
PyDoc_STRVAR(_testcapi_set_func_defaults_via_capi__doc__,
"set_func_defaults_via_capi($module, func, defaults, /)\n"
"--\n"
"\n");
#define _TESTCAPI_SET_FUNC_DEFAULTS_VIA_CAPI_METHODDEF \
{"set_func_defaults_via_capi", _PyCFunction_CAST(_testcapi_set_func_defaults_via_capi), METH_FASTCALL, _testcapi_set_func_defaults_via_capi__doc__},
static PyObject *
_testcapi_set_func_defaults_via_capi_impl(PyObject *module, PyObject *func,
PyObject *defaults);
static PyObject *
_testcapi_set_func_defaults_via_capi(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *func;
PyObject *defaults;
if (!_PyArg_CheckPositional("set_func_defaults_via_capi", nargs, 2, 2)) {
goto exit;
}
func = args[0];
defaults = args[1];
return_value = _testcapi_set_func_defaults_via_capi_impl(module, func, defaults);
exit:
return return_value;
}
PyDoc_STRVAR(_testcapi_set_func_kwdefaults_via_capi__doc__,
"set_func_kwdefaults_via_capi($module, func, defaults, /)\n"
"--\n"
"\n");
#define _TESTCAPI_SET_FUNC_KWDEFAULTS_VIA_CAPI_METHODDEF \
{"set_func_kwdefaults_via_capi", _PyCFunction_CAST(_testcapi_set_func_kwdefaults_via_capi), METH_FASTCALL, _testcapi_set_func_kwdefaults_via_capi__doc__},
static PyObject *
_testcapi_set_func_kwdefaults_via_capi_impl(PyObject *module, PyObject *func,
PyObject *defaults);
static PyObject *
_testcapi_set_func_kwdefaults_via_capi(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *func;
PyObject *defaults;
if (!_PyArg_CheckPositional("set_func_kwdefaults_via_capi", nargs, 2, 2)) {
goto exit;
}
func = args[0];
defaults = args[1];
return_value = _testcapi_set_func_kwdefaults_via_capi_impl(module, func, defaults);
exit:
return return_value;
}
/*[clinic end generated code: output=0e07ce7f295917a5 input=a9049054013a1b77]*/