@@ -576,6 +576,47 @@ pysqlite_connection_cursor_impl(pysqlite_Connection *self, PyObject *factory)
576576 return cursor ;
577577}
578578
579+ static PyObject *
580+ connection_get_row_factory (PyObject * op , void * closure )
581+ {
582+ pysqlite_Connection * self = (pysqlite_Connection * )op ;
583+ return Py_NewRef (self -> row_factory );
584+ }
585+
586+ static int
587+ connection_set_row_factory (PyObject * op , PyObject * value , void * closure )
588+ {
589+ pysqlite_Connection * self = (pysqlite_Connection * )op ;
590+ if (value == NULL ) {
591+ PyErr_SetString (PyExc_AttributeError ,
592+ "cannot delete row_factory attribute" );
593+ return -1 ;
594+ }
595+ Py_XSETREF (self -> row_factory , Py_NewRef (value ));
596+ return 0 ;
597+ }
598+
599+ static PyObject *
600+ connection_get_text_factory (PyObject * op , void * closure )
601+ {
602+ pysqlite_Connection * self = (pysqlite_Connection * )op ;
603+ return Py_NewRef (self -> text_factory );
604+ }
605+
606+ static int
607+ connection_set_text_factory (PyObject * op , PyObject * value , void * closure )
608+ {
609+ pysqlite_Connection * self = (pysqlite_Connection * )op ;
610+ if (value == NULL ) {
611+ PyErr_SetString (PyExc_AttributeError ,
612+ "cannot delete text_factory attribute" );
613+ return -1 ;
614+ }
615+ Py_XSETREF (self -> text_factory , Py_NewRef (value ));
616+ return 0 ;
617+ }
618+
619+
579620/*[clinic input]
580621_sqlite3.Connection.blobopen as blobopen
581622
@@ -2672,6 +2713,10 @@ static PyGetSetDef connection_getset[] = {
26722713 {"in_transaction" , pysqlite_connection_get_in_transaction , NULL },
26732714 {"autocommit" , get_autocommit , set_autocommit },
26742715 {"__text_signature__" , get_sig , NULL },
2716+ {"row_factory" , connection_get_row_factory ,
2717+ connection_set_row_factory },
2718+ {"text_factory" , connection_get_text_factory ,
2719+ connection_set_text_factory },
26752720 {NULL }
26762721};
26772722
@@ -2719,8 +2764,6 @@ static struct PyMemberDef connection_members[] =
27192764 {"InternalError" , _Py_T_OBJECT , offsetof(pysqlite_Connection , InternalError ), Py_READONLY },
27202765 {"ProgrammingError" , _Py_T_OBJECT , offsetof(pysqlite_Connection , ProgrammingError ), Py_READONLY },
27212766 {"NotSupportedError" , _Py_T_OBJECT , offsetof(pysqlite_Connection , NotSupportedError ), Py_READONLY },
2722- {"row_factory" , _Py_T_OBJECT , offsetof(pysqlite_Connection , row_factory )},
2723- {"text_factory" , _Py_T_OBJECT , offsetof(pysqlite_Connection , text_factory )},
27242767 {NULL }
27252768};
27262769
0 commit comments