@@ -1405,13 +1405,33 @@ static struct PyMemberDef cursor_members[] =
14051405 {"description" , _Py_T_OBJECT , offsetof(pysqlite_Cursor , description ), Py_READONLY },
14061406 {"lastrowid" , _Py_T_OBJECT , offsetof(pysqlite_Cursor , lastrowid ), Py_READONLY },
14071407 {"rowcount" , Py_T_LONG , offsetof(pysqlite_Cursor , rowcount ), Py_READONLY },
1408- {"row_factory" , _Py_T_OBJECT , offsetof(pysqlite_Cursor , row_factory ), 0 },
14091408 {"__weaklistoffset__" , Py_T_PYSSIZET , offsetof(pysqlite_Cursor , in_weakreflist ), Py_READONLY },
14101409 {NULL }
14111410};
14121411
1412+ static PyObject *
1413+ cursor_get_row_factory (PyObject * op , void * Py_UNUSED (closure ))
1414+ {
1415+ pysqlite_Cursor * self = _pysqlite_Cursor_CAST (op );
1416+ return Py_NewRef (self -> row_factory );
1417+ }
1418+
1419+ static int
1420+ cursor_set_row_factory (PyObject * op , PyObject * value , void * Py_UNUSED (closure ))
1421+ {
1422+ pysqlite_Cursor * self = _pysqlite_Cursor_CAST (op );
1423+ if (value == NULL ) {
1424+ PyErr_SetString (PyExc_AttributeError ,
1425+ "cannot delete row_factory attribute" );
1426+ return -1 ;
1427+ }
1428+ Py_XSETREF (self -> row_factory , Py_NewRef (value ));
1429+ return 0 ;
1430+ }
1431+
14131432static struct PyGetSetDef cursor_getsets [] = {
14141433 _SQLITE3_CURSOR_ARRAYSIZE_GETSETDEF
1434+ {"row_factory" , cursor_get_row_factory , cursor_set_row_factory },
14151435 {NULL },
14161436};
14171437
0 commit comments