@@ -557,6 +557,47 @@ pysqlite_connection_cursor_impl(pysqlite_Connection *self, PyObject *factory)
557557 return cursor ;
558558}
559559
560+ static PyObject *
561+ connection_get_row_factory (PyObject * op , void * closure )
562+ {
563+ pysqlite_Connection * self = (pysqlite_Connection * )op ;
564+ return Py_NewRef (self -> row_factory );
565+ }
566+
567+ static int
568+ connection_set_row_factory (PyObject * op , PyObject * value , void * closure )
569+ {
570+ pysqlite_Connection * self = (pysqlite_Connection * )op ;
571+ if (value == NULL ) {
572+ PyErr_SetString (PyExc_AttributeError ,
573+ "cannot delete row_factory attribute" );
574+ return -1 ;
575+ }
576+ Py_XSETREF (self -> row_factory , Py_NewRef (value ));
577+ return 0 ;
578+ }
579+
580+ static PyObject *
581+ connection_get_text_factory (PyObject * op , void * closure )
582+ {
583+ pysqlite_Connection * self = (pysqlite_Connection * )op ;
584+ return Py_NewRef (self -> text_factory );
585+ }
586+
587+ static int
588+ connection_set_text_factory (PyObject * op , PyObject * value , void * closure )
589+ {
590+ pysqlite_Connection * self = (pysqlite_Connection * )op ;
591+ if (value == NULL ) {
592+ PyErr_SetString (PyExc_AttributeError ,
593+ "cannot delete text_factory attribute" );
594+ return -1 ;
595+ }
596+ Py_XSETREF (self -> text_factory , Py_NewRef (value ));
597+ return 0 ;
598+ }
599+
600+
560601/*[clinic input]
561602_sqlite3.Connection.blobopen as blobopen
562603
@@ -2620,6 +2661,10 @@ static PyGetSetDef connection_getset[] = {
26202661 {"in_transaction" , pysqlite_connection_get_in_transaction , NULL },
26212662 {"autocommit" , get_autocommit , set_autocommit },
26222663 {"__text_signature__" , get_sig , NULL },
2664+ {"row_factory" , connection_get_row_factory ,
2665+ connection_set_row_factory },
2666+ {"text_factory" , connection_get_text_factory ,
2667+ connection_set_text_factory },
26232668 {NULL }
26242669};
26252670
@@ -2667,8 +2712,6 @@ static struct PyMemberDef connection_members[] =
26672712 {"InternalError" , _Py_T_OBJECT , offsetof(pysqlite_Connection , InternalError ), Py_READONLY },
26682713 {"ProgrammingError" , _Py_T_OBJECT , offsetof(pysqlite_Connection , ProgrammingError ), Py_READONLY },
26692714 {"NotSupportedError" , _Py_T_OBJECT , offsetof(pysqlite_Connection , NotSupportedError ), Py_READONLY },
2670- {"row_factory" , _Py_T_OBJECT , offsetof(pysqlite_Connection , row_factory )},
2671- {"text_factory" , _Py_T_OBJECT , offsetof(pysqlite_Connection , text_factory )},
26722715 {NULL }
26732716};
26742717
0 commit comments