[Python-checkins] gh-92206: Improve scoping of sqlite3 statement helper (#92260)
JelleZijlstra
webhook-mailer at python.org
Tue May 3 18:07:17 EDT 2022
https://github.com/python/cpython/commit/6b7dcc56072d19d3edbc905d0bb20bd0b4463d19
commit: 6b7dcc56072d19d3edbc905d0bb20bd0b4463d19
branch: main
author: Erlend Egeberg Aasland <erlend.aasland at protonmail.com>
committer: JelleZijlstra <jelle.zijlstra at gmail.com>
date: 2022-05-03T16:07:11-06:00
summary:
gh-92206: Improve scoping of sqlite3 statement helper (#92260)
files:
M Modules/_sqlite/cursor.c
M Modules/_sqlite/statement.c
M Modules/_sqlite/statement.h
diff --git a/Modules/_sqlite/cursor.c b/Modules/_sqlite/cursor.c
index 16bceef2e5024..87fed2e46e10e 100644
--- a/Modules/_sqlite/cursor.c
+++ b/Modules/_sqlite/cursor.c
@@ -754,6 +754,12 @@ bind_parameters(pysqlite_state *state, pysqlite_Statement *self,
}
}
+static inline void
+stmt_mark_dirty(pysqlite_Statement *self)
+{
+ self->in_use = 1;
+}
+
PyObject *
_pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* operation, PyObject* second_argument)
{
@@ -844,7 +850,7 @@ _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* operation
}
stmt_reset(self->statement);
- pysqlite_statement_mark_dirty(self->statement);
+ stmt_mark_dirty(self->statement);
/* We start a transaction implicitly before a DML statement.
SELECT is the only exception. See #9924. */
@@ -863,7 +869,7 @@ _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* operation
break;
}
- pysqlite_statement_mark_dirty(self->statement);
+ stmt_mark_dirty(self->statement);
bind_parameters(state, self->statement, parameters);
if (PyErr_Occurred()) {
diff --git a/Modules/_sqlite/statement.c b/Modules/_sqlite/statement.c
index d0a404f13b200..f9cb70f0ef146 100644
--- a/Modules/_sqlite/statement.c
+++ b/Modules/_sqlite/statement.c
@@ -116,11 +116,6 @@ pysqlite_statement_create(pysqlite_Connection *connection, PyObject *sql)
return NULL;
}
-void pysqlite_statement_mark_dirty(pysqlite_Statement* self)
-{
- self->in_use = 1;
-}
-
static void
stmt_dealloc(pysqlite_Statement *self)
{
diff --git a/Modules/_sqlite/statement.h b/Modules/_sqlite/statement.h
index 88d56779854be..5e61227424baf 100644
--- a/Modules/_sqlite/statement.h
+++ b/Modules/_sqlite/statement.h
@@ -39,8 +39,6 @@ typedef struct
pysqlite_Statement *pysqlite_statement_create(pysqlite_Connection *connection, PyObject *sql);
-void pysqlite_statement_mark_dirty(pysqlite_Statement* self);
-
int pysqlite_statement_setup_types(PyObject *module);
#endif
More information about the Python-checkins
mailing list