23
23
24
24
#include "row.h"
25
25
#include "cursor.h"
26
+ #include "clinic/row.c.h"
27
+
28
+ /*[clinic input]
29
+ module _sqlite3
30
+ class _sqlite3.Row "pysqlite_Row *" "&pysqlite_RowType"
31
+ [clinic start generated code]*/
32
+ /*[clinic end generated code: output=da39a3ee5e6b4b0d input=5fe72209a8a6e40c]*/
26
33
27
34
void pysqlite_row_dealloc (pysqlite_Row * self )
28
35
{
@@ -32,30 +39,25 @@ void pysqlite_row_dealloc(pysqlite_Row* self)
32
39
Py_TYPE (self )-> tp_free ((PyObject * )self );
33
40
}
34
41
42
+ /*[clinic input]
43
+ @classmethod
44
+ _sqlite3.Row.__new__ as pysqlite_row_new
45
+
46
+ cursor: object(type='pysqlite_Cursor *', subclass_of='&pysqlite_CursorType')
47
+ data: object(subclass_of='&PyTuple_Type')
48
+ /
49
+
50
+ [clinic start generated code]*/
51
+
35
52
static PyObject *
36
- pysqlite_row_new (PyTypeObject * type , PyObject * args , PyObject * kwargs )
53
+ pysqlite_row_new_impl (PyTypeObject * type , pysqlite_Cursor * cursor ,
54
+ PyObject * data )
55
+ /*[clinic end generated code: output=10d58b09a819a4c1 input=3bb62e4657f18d81]*/
37
56
{
38
57
pysqlite_Row * self ;
39
- PyObject * data ;
40
- pysqlite_Cursor * cursor ;
41
58
42
59
assert (type != NULL && type -> tp_alloc != NULL );
43
60
44
- if (!_PyArg_NoKeywords ("Row" , kwargs ))
45
- return NULL ;
46
- if (!PyArg_ParseTuple (args , "OO" , & cursor , & data ))
47
- return NULL ;
48
-
49
- if (!PyObject_TypeCheck ((PyObject * )cursor , & pysqlite_CursorType )) {
50
- PyErr_SetString (PyExc_TypeError , "instance of cursor required for first argument" );
51
- return NULL ;
52
- }
53
-
54
- if (!PyTuple_Check (data )) {
55
- PyErr_SetString (PyExc_TypeError , "tuple required for second argument" );
56
- return NULL ;
57
- }
58
-
59
61
self = (pysqlite_Row * ) type -> tp_alloc (type , 0 );
60
62
if (self == NULL )
61
63
return NULL ;
@@ -156,7 +158,15 @@ pysqlite_row_length(pysqlite_Row* self)
156
158
return PyTuple_GET_SIZE (self -> data );
157
159
}
158
160
159
- PyObject * pysqlite_row_keys (pysqlite_Row * self , PyObject * Py_UNUSED (ignored ))
161
+ /*[clinic input]
162
+ _sqlite3.Row.keys as pysqlite_row_keys
163
+
164
+ Returns the keys of the row.
165
+ [clinic start generated code]*/
166
+
167
+ static PyObject *
168
+ pysqlite_row_keys_impl (pysqlite_Row * self )
169
+ /*[clinic end generated code: output=efe3dfb3af6edc07 input=7549a122827c5563]*/
160
170
{
161
171
PyObject * list ;
162
172
Py_ssize_t nitems , i ;
@@ -221,8 +231,7 @@ static PySequenceMethods pysqlite_row_as_sequence = {
221
231
222
232
223
233
static PyMethodDef pysqlite_row_methods [] = {
224
- {"keys" , (PyCFunction )pysqlite_row_keys , METH_NOARGS ,
225
- PyDoc_STR ("Returns the keys of the row." )},
234
+ PYSQLITE_ROW_KEYS_METHODDEF
226
235
{NULL , NULL }
227
236
};
228
237
0 commit comments