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=384227da65f250fd]*/
26
33
27
34
void pysqlite_row_dealloc (pysqlite_Row * self )
28
35
{
@@ -35,30 +42,25 @@ void pysqlite_row_dealloc(pysqlite_Row* self)
35
42
Py_DECREF (tp );
36
43
}
37
44
45
+ /*[clinic input]
46
+ @classmethod
47
+ _sqlite3.Row.__new__ as pysqlite_row_new
48
+
49
+ cursor: object(type='pysqlite_Cursor *', subclass_of='pysqlite_CursorType')
50
+ data: object(subclass_of='&PyTuple_Type')
51
+ /
52
+
53
+ [clinic start generated code]*/
54
+
38
55
static PyObject *
39
- pysqlite_row_new (PyTypeObject * type , PyObject * args , PyObject * kwargs )
56
+ pysqlite_row_new_impl (PyTypeObject * type , pysqlite_Cursor * cursor ,
57
+ PyObject * data )
58
+ /*[clinic end generated code: output=10d58b09a819a4c1 input=f6cd7e6e0935828d]*/
40
59
{
41
60
pysqlite_Row * self ;
42
- PyObject * data ;
43
- pysqlite_Cursor * cursor ;
44
61
45
62
assert (type != NULL && type -> tp_alloc != NULL );
46
63
47
- if (!_PyArg_NoKeywords ("Row" , kwargs ))
48
- return NULL ;
49
- if (!PyArg_ParseTuple (args , "OO" , & cursor , & data ))
50
- return NULL ;
51
-
52
- if (!PyObject_TypeCheck ((PyObject * )cursor , pysqlite_CursorType )) {
53
- PyErr_SetString (PyExc_TypeError , "instance of cursor required for first argument" );
54
- return NULL ;
55
- }
56
-
57
- if (!PyTuple_Check (data )) {
58
- PyErr_SetString (PyExc_TypeError , "tuple required for second argument" );
59
- return NULL ;
60
- }
61
-
62
64
self = (pysqlite_Row * ) type -> tp_alloc (type , 0 );
63
65
if (self == NULL )
64
66
return NULL ;
@@ -153,7 +155,15 @@ pysqlite_row_length(pysqlite_Row* self)
153
155
return PyTuple_GET_SIZE (self -> data );
154
156
}
155
157
156
- PyObject * pysqlite_row_keys (pysqlite_Row * self , PyObject * Py_UNUSED (ignored ))
158
+ /*[clinic input]
159
+ _sqlite3.Row.keys as pysqlite_row_keys
160
+
161
+ Returns the keys of the row.
162
+ [clinic start generated code]*/
163
+
164
+ static PyObject *
165
+ pysqlite_row_keys_impl (pysqlite_Row * self )
166
+ /*[clinic end generated code: output=efe3dfb3af6edc07 input=7549a122827c5563]*/
157
167
{
158
168
PyObject * list ;
159
169
Py_ssize_t nitems , i ;
@@ -204,8 +214,7 @@ static PyObject* pysqlite_row_richcompare(pysqlite_Row *self, PyObject *_other,
204
214
}
205
215
206
216
static PyMethodDef row_methods [] = {
207
- {"keys" , (PyCFunction )pysqlite_row_keys , METH_NOARGS ,
208
- PyDoc_STR ("Returns the keys of the row." )},
217
+ PYSQLITE_ROW_KEYS_METHODDEF
209
218
{NULL , NULL }
210
219
};
211
220
0 commit comments