@@ -1348,13 +1348,33 @@ static struct PyMemberDef cursor_members[] =
13481348 {"description" , _Py_T_OBJECT , offsetof(pysqlite_Cursor , description ), Py_READONLY },
13491349 {"lastrowid" , _Py_T_OBJECT , offsetof(pysqlite_Cursor , lastrowid ), Py_READONLY },
13501350 {"rowcount" , Py_T_LONG , offsetof(pysqlite_Cursor , rowcount ), Py_READONLY },
1351- {"row_factory" , _Py_T_OBJECT , offsetof(pysqlite_Cursor , row_factory ), 0 },
13521351 {"__weaklistoffset__" , Py_T_PYSSIZET , offsetof(pysqlite_Cursor , in_weakreflist ), Py_READONLY },
13531352 {NULL }
13541353};
13551354
1355+ static PyObject *
1356+ cursor_get_row_factory (PyObject * op , void * Py_UNUSED (closure ))
1357+ {
1358+ pysqlite_Cursor * self = _pysqlite_Cursor_CAST (op );
1359+ return Py_NewRef (self -> row_factory );
1360+ }
1361+
1362+ static int
1363+ cursor_set_row_factory (PyObject * op , PyObject * value , void * Py_UNUSED (closure ))
1364+ {
1365+ pysqlite_Cursor * self = _pysqlite_Cursor_CAST (op );
1366+ if (value == NULL ) {
1367+ PyErr_SetString (PyExc_AttributeError ,
1368+ "cannot delete row_factory attribute" );
1369+ return -1 ;
1370+ }
1371+ Py_XSETREF (self -> row_factory , Py_NewRef (value ));
1372+ return 0 ;
1373+ }
1374+
13561375static struct PyGetSetDef cursor_getsets [] = {
13571376 _SQLITE3_CURSOR_ARRAYSIZE_GETSETDEF
1377+ {"row_factory" , cursor_get_row_factory , cursor_set_row_factory },
13581378 {NULL },
13591379};
13601380
0 commit comments