@@ -357,7 +357,7 @@ _pysqlite_fetch_one_row(pysqlite_Cursor* self)
357
357
if (!converted ) {
358
358
goto error ;
359
359
}
360
- PyTuple_SetItem (row , i , converted );
360
+ PyTuple_SET_ITEM (row , i , converted );
361
361
}
362
362
363
363
if (PyErr_Occurred ())
@@ -406,7 +406,6 @@ _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* operation
406
406
PyObject * func_args ;
407
407
PyObject * result ;
408
408
int numcols ;
409
- PyObject * descriptor ;
410
409
PyObject * column_name ;
411
410
sqlite_int64 lastrowid ;
412
411
@@ -470,9 +469,7 @@ _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* operation
470
469
if (!func_args ) {
471
470
goto error ;
472
471
}
473
- if (PyTuple_SetItem (func_args , 0 , Py_NewRef (operation )) != 0 ) {
474
- goto error ;
475
- }
472
+ PyTuple_SET_ITEM (func_args , 0 , Py_NewRef (operation ));
476
473
477
474
if (self -> statement ) {
478
475
(void )pysqlite_statement_reset (self -> statement );
@@ -557,30 +554,29 @@ _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* operation
557
554
goto error ;
558
555
}
559
556
for (i = 0 ; i < numcols ; i ++ ) {
560
- descriptor = PyTuple_New (7 );
561
- if (!descriptor ) {
562
- goto error ;
563
- }
564
557
const char * colname ;
565
558
colname = sqlite3_column_name (self -> statement -> st , i );
566
559
if (colname == NULL ) {
567
560
PyErr_NoMemory ();
568
- Py_DECREF (descriptor );
561
+ goto error ;
562
+ }
563
+ PyObject * descriptor = PyTuple_New (7 );
564
+ if (descriptor == NULL ) {
569
565
goto error ;
570
566
}
571
567
column_name = _pysqlite_build_column_name (self , colname );
572
568
if (column_name == NULL ) {
573
569
Py_DECREF (descriptor );
574
570
goto error ;
575
571
}
576
- PyTuple_SetItem (descriptor , 0 , column_name );
577
- PyTuple_SetItem (descriptor , 1 , Py_NewRef (Py_None ));
578
- PyTuple_SetItem (descriptor , 2 , Py_NewRef (Py_None ));
579
- PyTuple_SetItem (descriptor , 3 , Py_NewRef (Py_None ));
580
- PyTuple_SetItem (descriptor , 4 , Py_NewRef (Py_None ));
581
- PyTuple_SetItem (descriptor , 5 , Py_NewRef (Py_None ));
582
- PyTuple_SetItem (descriptor , 6 , Py_NewRef (Py_None ));
583
- PyTuple_SetItem (self -> description , i , descriptor );
572
+ PyTuple_SET_ITEM (descriptor , 0 , column_name );
573
+ PyTuple_SET_ITEM (descriptor , 1 , Py_NewRef (Py_None ));
574
+ PyTuple_SET_ITEM (descriptor , 2 , Py_NewRef (Py_None ));
575
+ PyTuple_SET_ITEM (descriptor , 3 , Py_NewRef (Py_None ));
576
+ PyTuple_SET_ITEM (descriptor , 4 , Py_NewRef (Py_None ));
577
+ PyTuple_SET_ITEM (descriptor , 5 , Py_NewRef (Py_None ));
578
+ PyTuple_SET_ITEM (descriptor , 6 , Py_NewRef (Py_None ));
579
+ PyTuple_SET_ITEM (self -> description , i , descriptor );
584
580
}
585
581
}
586
582
0 commit comments