@@ -135,6 +135,8 @@ sqlite3_int64_converter(PyObject *obj, sqlite3_int64 *result)
135135#include "clinic/connection.c.h"
136136#undef clinic_state
137137
138+ #define _pysqlite_Connection_CAST (op ) ((pysqlite_Connection *)(op))
139+
138140/*[clinic input]
139141module _sqlite3
140142class _sqlite3.Connection "pysqlite_Connection *" "clinic_state()->ConnectionType"
@@ -384,8 +386,9 @@ do { \
384386} while (0)
385387
386388static int
387- connection_traverse (pysqlite_Connection * self , visitproc visit , void * arg )
389+ connection_traverse (PyObject * op , visitproc visit , void * arg )
388390{
391+ pysqlite_Connection * self = _pysqlite_Connection_CAST (op );
389392 Py_VISIT (Py_TYPE (self ));
390393 Py_VISIT (self -> statement_cache );
391394 Py_VISIT (self -> cursors );
@@ -409,8 +412,9 @@ clear_callback_context(callback_context *ctx)
409412}
410413
411414static int
412- connection_clear (pysqlite_Connection * self )
415+ connection_clear (PyObject * op )
413416{
417+ pysqlite_Connection * self = _pysqlite_Connection_CAST (op );
414418 Py_CLEAR (self -> statement_cache );
415419 Py_CLEAR (self -> cursors );
416420 Py_CLEAR (self -> blobs );
@@ -517,7 +521,7 @@ connection_dealloc(PyObject *self)
517521 }
518522 PyTypeObject * tp = Py_TYPE (self );
519523 PyObject_GC_UnTrack (self );
520- tp -> tp_clear (self );
524+ ( void ) tp -> tp_clear (self );
521525 tp -> tp_free (self );
522526 Py_DECREF (tp );
523527}
@@ -1715,8 +1719,10 @@ int pysqlite_check_thread(pysqlite_Connection* self)
17151719 return 1 ;
17161720}
17171721
1718- static PyObject * pysqlite_connection_get_isolation_level (pysqlite_Connection * self , void * unused )
1722+ static PyObject *
1723+ pysqlite_connection_get_isolation_level (PyObject * op , void * Py_UNUSED (closure ))
17191724{
1725+ pysqlite_Connection * self = _pysqlite_Connection_CAST (op );
17201726 if (!pysqlite_check_connection (self )) {
17211727 return NULL ;
17221728 }
@@ -1726,16 +1732,20 @@ static PyObject* pysqlite_connection_get_isolation_level(pysqlite_Connection* se
17261732 Py_RETURN_NONE ;
17271733}
17281734
1729- static PyObject * pysqlite_connection_get_total_changes (pysqlite_Connection * self , void * unused )
1735+ static PyObject *
1736+ pysqlite_connection_get_total_changes (PyObject * op , void * Py_UNUSED (closure ))
17301737{
1738+ pysqlite_Connection * self = _pysqlite_Connection_CAST (op );
17311739 if (!pysqlite_check_connection (self )) {
17321740 return NULL ;
17331741 }
17341742 return PyLong_FromLong (sqlite3_total_changes (self -> db ));
17351743}
17361744
1737- static PyObject * pysqlite_connection_get_in_transaction (pysqlite_Connection * self , void * unused )
1745+ static PyObject *
1746+ pysqlite_connection_get_in_transaction (PyObject * op , void * Py_UNUSED (closure ))
17381747{
1748+ pysqlite_Connection * self = _pysqlite_Connection_CAST (op );
17391749 if (!pysqlite_check_connection (self )) {
17401750 return NULL ;
17411751 }
@@ -1746,8 +1756,11 @@ static PyObject* pysqlite_connection_get_in_transaction(pysqlite_Connection* sel
17461756}
17471757
17481758static int
1749- pysqlite_connection_set_isolation_level (pysqlite_Connection * self , PyObject * isolation_level , void * Py_UNUSED (ignored ))
1759+ pysqlite_connection_set_isolation_level (PyObject * op ,
1760+ PyObject * isolation_level ,
1761+ void * Py_UNUSED (ignored ))
17501762{
1763+ pysqlite_Connection * self = _pysqlite_Connection_CAST (op );
17511764 if (isolation_level == NULL ) {
17521765 PyErr_SetString (PyExc_AttributeError , "cannot delete attribute" );
17531766 return -1 ;
@@ -1770,11 +1783,11 @@ pysqlite_connection_set_isolation_level(pysqlite_Connection* self, PyObject* iso
17701783}
17711784
17721785static PyObject *
1773- pysqlite_connection_call (pysqlite_Connection * self , PyObject * args ,
1774- PyObject * kwargs )
1786+ pysqlite_connection_call (PyObject * op , PyObject * args , PyObject * kwargs )
17751787{
17761788 PyObject * sql ;
17771789 pysqlite_Statement * statement ;
1790+ pysqlite_Connection * self = _pysqlite_Connection_CAST (op );
17781791
17791792 if (!pysqlite_check_thread (self ) || !pysqlite_check_connection (self )) {
17801793 return NULL ;
@@ -2525,8 +2538,9 @@ getconfig_impl(pysqlite_Connection *self, int op)
25252538}
25262539
25272540static PyObject *
2528- get_autocommit (pysqlite_Connection * self , void * Py_UNUSED (ctx ))
2541+ get_autocommit (PyObject * op , void * Py_UNUSED (closure ))
25292542{
2543+ pysqlite_Connection * self = _pysqlite_Connection_CAST (op );
25302544 if (!pysqlite_check_thread (self ) || !pysqlite_check_connection (self )) {
25312545 return NULL ;
25322546 }
@@ -2540,8 +2554,9 @@ get_autocommit(pysqlite_Connection *self, void *Py_UNUSED(ctx))
25402554}
25412555
25422556static int
2543- set_autocommit (pysqlite_Connection * self , PyObject * val , void * Py_UNUSED (ctx ))
2557+ set_autocommit (PyObject * op , PyObject * val , void * Py_UNUSED (closure ))
25442558{
2559+ pysqlite_Connection * self = _pysqlite_Connection_CAST (op );
25452560 if (!pysqlite_check_thread (self ) || !pysqlite_check_connection (self )) {
25462561 return -1 ;
25472562 }
@@ -2566,7 +2581,7 @@ set_autocommit(pysqlite_Connection *self, PyObject *val, void *Py_UNUSED(ctx))
25662581}
25672582
25682583static PyObject *
2569- get_sig (PyObject * self , void * Py_UNUSED (ctx ))
2584+ get_sig (PyObject * Py_UNUSED ( self ) , void * Py_UNUSED (closure ))
25702585{
25712586 return PyUnicode_FromString ("(sql, /)" );
25722587}
@@ -2576,11 +2591,12 @@ static const char connection_doc[] =
25762591PyDoc_STR ("SQLite database connection object." );
25772592
25782593static PyGetSetDef connection_getset [] = {
2579- {"isolation_level" , (getter )pysqlite_connection_get_isolation_level , (setter )pysqlite_connection_set_isolation_level },
2580- {"total_changes" , (getter )pysqlite_connection_get_total_changes , (setter )0 },
2581- {"in_transaction" , (getter )pysqlite_connection_get_in_transaction , (setter )0 },
2582- {"autocommit" , (getter )get_autocommit , (setter )set_autocommit },
2583- {"__text_signature__" , get_sig , (setter )0 },
2594+ {"isolation_level" , pysqlite_connection_get_isolation_level ,
2595+ pysqlite_connection_set_isolation_level },
2596+ {"total_changes" , pysqlite_connection_get_total_changes , NULL },
2597+ {"in_transaction" , pysqlite_connection_get_in_transaction , NULL },
2598+ {"autocommit" , get_autocommit , set_autocommit },
2599+ {"__text_signature__" , get_sig , NULL },
25842600 {NULL }
25852601};
25862602
0 commit comments