@@ -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
@@ -557,30 +556,24 @@ _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* operation
557
556
goto error ;
558
557
}
559
558
for (i = 0 ; i < numcols ; i ++ ) {
560
- descriptor = PyTuple_New (7 );
561
- if (!descriptor ) {
562
- goto error ;
563
- }
564
559
const char * colname ;
565
560
colname = sqlite3_column_name (self -> statement -> st , i );
566
561
if (colname == NULL ) {
567
562
PyErr_NoMemory ();
568
- Py_DECREF (descriptor );
569
563
goto error ;
570
564
}
571
565
column_name = _pysqlite_build_column_name (self , colname );
572
566
if (column_name == NULL ) {
573
- Py_DECREF (descriptor );
574
567
goto error ;
575
568
}
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 );
569
+ PyObject * descriptor = PyTuple_Pack ( 7 , column_name ,
570
+ Py_None , Py_None , Py_None ,
571
+ Py_None , Py_None , Py_None );
572
+ Py_DECREF ( column_name );
573
+ if (descriptor == NULL ) {
574
+ goto error ;
575
+ }
576
+ PyTuple_SET_ITEM (self -> description , i , descriptor );
584
577
}
585
578
}
586
579
0 commit comments