Skip to content

Commit 6b7dcc5

Browse files
gh-92206: Improve scoping of sqlite3 statement helper (#92260)
1 parent 27e3665 commit 6b7dcc5

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

Modules/_sqlite/cursor.c

+8-2
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,12 @@ bind_parameters(pysqlite_state *state, pysqlite_Statement *self,
754754
}
755755
}
756756

757+
static inline void
758+
stmt_mark_dirty(pysqlite_Statement *self)
759+
{
760+
self->in_use = 1;
761+
}
762+
757763
PyObject *
758764
_pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* operation, PyObject* second_argument)
759765
{
@@ -844,7 +850,7 @@ _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* operation
844850
}
845851

846852
stmt_reset(self->statement);
847-
pysqlite_statement_mark_dirty(self->statement);
853+
stmt_mark_dirty(self->statement);
848854

849855
/* We start a transaction implicitly before a DML statement.
850856
SELECT is the only exception. See #9924. */
@@ -863,7 +869,7 @@ _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* operation
863869
break;
864870
}
865871

866-
pysqlite_statement_mark_dirty(self->statement);
872+
stmt_mark_dirty(self->statement);
867873

868874
bind_parameters(state, self->statement, parameters);
869875
if (PyErr_Occurred()) {

Modules/_sqlite/statement.c

-5
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,6 @@ pysqlite_statement_create(pysqlite_Connection *connection, PyObject *sql)
116116
return NULL;
117117
}
118118

119-
void pysqlite_statement_mark_dirty(pysqlite_Statement* self)
120-
{
121-
self->in_use = 1;
122-
}
123-
124119
static void
125120
stmt_dealloc(pysqlite_Statement *self)
126121
{

Modules/_sqlite/statement.h

-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ typedef struct
3939

4040
pysqlite_Statement *pysqlite_statement_create(pysqlite_Connection *connection, PyObject *sql);
4141

42-
void pysqlite_statement_mark_dirty(pysqlite_Statement* self);
43-
4442
int pysqlite_statement_setup_types(PyObject *module);
4543

4644
#endif

0 commit comments

Comments
 (0)