diff options
author | Erlend Egeberg Aasland <erlend.aasland@innova.no> | 2020-12-29 13:22:55 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-29 13:22:55 (GMT) |
commit | 84d79cfda947f6bc28a5aa11db8055aa40a6b03a (patch) | |
tree | ad6544ec1837c38851703bcc3d7aaa995cfe2c10 /Modules/_sqlite/clinic | |
parent | 0159e5efeebd12b3cf365c8569ca000eac7cb03e (diff) | |
download | cpython-84d79cfda947f6bc28a5aa11db8055aa40a6b03a.zip cpython-84d79cfda947f6bc28a5aa11db8055aa40a6b03a.tar.gz cpython-84d79cfda947f6bc28a5aa11db8055aa40a6b03a.tar.bz2 |
bpo-40956: Convert _sqlite3.Row to Argument Clinic (GH-23964)
Diffstat (limited to 'Modules/_sqlite/clinic')
-rw-r--r-- | Modules/_sqlite/clinic/row.c.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/Modules/_sqlite/clinic/row.c.h b/Modules/_sqlite/clinic/row.c.h new file mode 100644 index 0000000..7ff1109 --- /dev/null +++ b/Modules/_sqlite/clinic/row.c.h @@ -0,0 +1,56 @@ +/*[clinic input] +preserve +[clinic start generated code]*/ + +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; + pysqlite_Cursor *cursor; + PyObject *data; + + if ((type == pysqlite_RowType) && + !_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), pysqlite_CursorType)) { + _PyArg_BadArgument("Row", "argument 1", (pysqlite_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=8d29220b9cde035d input=a9049054013a1b77]*/ |