@@ -1357,13 +1357,33 @@ static struct PyMemberDef cursor_members[] =
13571357 {"description" , _Py_T_OBJECT , offsetof(pysqlite_Cursor , description ), Py_READONLY },
13581358 {"lastrowid" , _Py_T_OBJECT , offsetof(pysqlite_Cursor , lastrowid ), Py_READONLY },
13591359 {"rowcount" , Py_T_LONG , offsetof(pysqlite_Cursor , rowcount ), Py_READONLY },
1360- {"row_factory" , _Py_T_OBJECT , offsetof(pysqlite_Cursor , row_factory ), 0 },
13611360 {"__weaklistoffset__" , Py_T_PYSSIZET , offsetof(pysqlite_Cursor , in_weakreflist ), Py_READONLY },
13621361 {NULL }
13631362};
13641363
1364+ static PyObject *
1365+ cursor_get_row_factory (PyObject * op , void * Py_UNUSED (closure ))
1366+ {
1367+ pysqlite_Cursor * self = (pysqlite_Cursor * )op ;
1368+ return Py_NewRef (self -> row_factory );
1369+ }
1370+
1371+ static int
1372+ cursor_set_row_factory (PyObject * op , PyObject * value , void * Py_UNUSED (closure ))
1373+ {
1374+ pysqlite_Cursor * self = (pysqlite_Cursor * )op ;
1375+ if (value == NULL ) {
1376+ PyErr_SetString (PyExc_AttributeError ,
1377+ "cannot delete row_factory attribute" );
1378+ return -1 ;
1379+ }
1380+ Py_XSETREF (self -> row_factory , Py_NewRef (value ));
1381+ return 0 ;
1382+ }
1383+
13651384static struct PyGetSetDef cursor_getsets [] = {
13661385 _SQLITE3_CURSOR_ARRAYSIZE_GETSETDEF
1386+ {"row_factory" , cursor_get_row_factory , cursor_set_row_factory },
13671387 {NULL },
13681388};
13691389
0 commit comments