mirror of
https://github.com/python/cpython.git
synced 2025-07-27 05:04:15 +00:00

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
59 lines
1.8 KiB
C
Generated
59 lines
1.8 KiB
C
Generated
/*[clinic input]
|
|
preserve
|
|
[clinic start generated code]*/
|
|
|
|
#include "pycore_modsupport.h" // _PyArg_CheckPositional()
|
|
|
|
static PyObject *
|
|
pysqlite_row_new_impl(PyTypeObject *type, pysqlite_Cursor *cursor,
|
|
PyObject *data);
|
|
|
|
static PyObject *
|
|
pysqlite_row_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
|
{
|
|
PyObject *return_value = NULL;
|
|
PyTypeObject *base_tp = clinic_state()->RowType;
|
|
pysqlite_Cursor *cursor;
|
|
PyObject *data;
|
|
|
|
if ((type == base_tp || type->tp_init == base_tp->tp_init) &&
|
|
!_PyArg_NoKeywords("Row", kwargs)) {
|
|
goto exit;
|
|
}
|
|
if (!_PyArg_CheckPositional("Row", PyTuple_GET_SIZE(args), 2, 2)) {
|
|
goto exit;
|
|
}
|
|
if (!PyObject_TypeCheck(PyTuple_GET_ITEM(args, 0), clinic_state()->CursorType)) {
|
|
_PyArg_BadArgument("Row", "argument 1", (clinic_state()->CursorType)->tp_name, PyTuple_GET_ITEM(args, 0));
|
|
goto exit;
|
|
}
|
|
cursor = (pysqlite_Cursor *)PyTuple_GET_ITEM(args, 0);
|
|
if (!PyTuple_Check(PyTuple_GET_ITEM(args, 1))) {
|
|
_PyArg_BadArgument("Row", "argument 2", "tuple", PyTuple_GET_ITEM(args, 1));
|
|
goto exit;
|
|
}
|
|
data = PyTuple_GET_ITEM(args, 1);
|
|
return_value = pysqlite_row_new_impl(type, cursor, data);
|
|
|
|
exit:
|
|
return return_value;
|
|
}
|
|
|
|
PyDoc_STRVAR(pysqlite_row_keys__doc__,
|
|
"keys($self, /)\n"
|
|
"--\n"
|
|
"\n"
|
|
"Returns the keys of the row.");
|
|
|
|
#define PYSQLITE_ROW_KEYS_METHODDEF \
|
|
{"keys", (PyCFunction)pysqlite_row_keys, METH_NOARGS, pysqlite_row_keys__doc__},
|
|
|
|
static PyObject *
|
|
pysqlite_row_keys_impl(pysqlite_Row *self);
|
|
|
|
static PyObject *
|
|
pysqlite_row_keys(pysqlite_Row *self, PyObject *Py_UNUSED(ignored))
|
|
{
|
|
return pysqlite_row_keys_impl(self);
|
|
}
|
|
/*[clinic end generated code: output=788bf817acc02b8e input=a9049054013a1b77]*/
|