File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -802,29 +802,29 @@ PyObject* pysqlite_cursor_iternext(pysqlite_Cursor *self)
802802 if (self -> statement ) {
803803 rc = pysqlite_step (self -> statement -> st , self -> connection );
804804 if (PyErr_Occurred ()) {
805- (void )pysqlite_statement_reset (self -> statement );
806- Py_DECREF (next_row );
807- return NULL ;
805+ goto error ;
808806 }
809807 if (rc != SQLITE_DONE && rc != SQLITE_ROW ) {
810- (void )pysqlite_statement_reset (self -> statement );
811- Py_DECREF (next_row );
812808 _pysqlite_seterror (self -> connection -> db , NULL );
813- return NULL ;
809+ goto error ;
814810 }
815811
816812 if (rc == SQLITE_ROW ) {
817813 self -> locked = 1 ; // GH-80254: Prevent recursive use of cursors.
818814 self -> next_row = _pysqlite_fetch_one_row (self );
819815 self -> locked = 0 ;
820816 if (self -> next_row == NULL ) {
821- (void )pysqlite_statement_reset (self -> statement );
822- return NULL ;
817+ goto error ;
823818 }
824819 }
825820 }
826821
827822 return next_row ;
823+
824+ error :
825+ (void )pysqlite_statement_reset (self -> statement );
826+ Py_DECREF (next_row );
827+ return NULL ;
828828}
829829
830830PyObject * pysqlite_cursor_fetchone (pysqlite_Cursor * self , PyObject * args )
You can’t perform that action at this time.
0 commit comments