@@ -84,9 +84,7 @@ pysqlite_statement_create(pysqlite_Connection *connection, PyObject *sql)
8484 return NULL ;
8585 }
8686
87- self -> db = connection -> db ;
8887 self -> st = NULL ;
89- self -> sql = Py_NewRef (sql );
9088 self -> in_use = 0 ;
9189 self -> is_dml = 0 ;
9290 self -> in_weakreflist = NULL ;
@@ -110,7 +108,7 @@ pysqlite_statement_create(pysqlite_Connection *connection, PyObject *sql)
110108 }
111109
112110 Py_BEGIN_ALLOW_THREADS
113- rc = sqlite3_prepare_v2 (self -> db ,
111+ rc = sqlite3_prepare_v2 (connection -> db ,
114112 sql_cstr ,
115113 (int )sql_cstr_len + 1 ,
116114 & self -> st ,
@@ -120,7 +118,7 @@ pysqlite_statement_create(pysqlite_Connection *connection, PyObject *sql)
120118 PyObject_GC_Track (self );
121119
122120 if (rc != SQLITE_OK ) {
123- _pysqlite_seterror (self -> db );
121+ _pysqlite_seterror (connection -> db );
124122 goto error ;
125123 }
126124
@@ -409,23 +407,14 @@ stmt_dealloc(pysqlite_Statement *self)
409407 Py_END_ALLOW_THREADS
410408 self -> st = 0 ;
411409 }
412- tp -> tp_clear ((PyObject * )self );
413410 tp -> tp_free (self );
414411 Py_DECREF (tp );
415412}
416413
417- static int
418- stmt_clear (pysqlite_Statement * self )
419- {
420- Py_CLEAR (self -> sql );
421- return 0 ;
422- }
423-
424414static int
425415stmt_traverse (pysqlite_Statement * self , visitproc visit , void * arg )
426416{
427417 Py_VISIT (Py_TYPE (self ));
428- Py_VISIT (self -> sql );
429418 return 0 ;
430419}
431420
@@ -507,7 +496,6 @@ static PyType_Slot stmt_slots[] = {
507496 {Py_tp_members , stmt_members },
508497 {Py_tp_dealloc , stmt_dealloc },
509498 {Py_tp_traverse , stmt_traverse },
510- {Py_tp_clear , stmt_clear },
511499 {0 , NULL },
512500};
513501
0 commit comments