summaryrefslogtreecommitdiffstats
path: root/Modules/_sqlite/cursor.c
diff options
context:
space:
mode:
authorErlend Egeberg Aasland <erlend.aasland@protonmail.com>2022-05-03 22:07:11 (GMT)
committerGitHub <noreply@github.com>2022-05-03 22:07:11 (GMT)
commit6b7dcc56072d19d3edbc905d0bb20bd0b4463d19 (patch)
tree8acde8e858bc48d6d1a912c9f3a2629cacc1fc78 /Modules/_sqlite/cursor.c
parent27e366571590e9e98f61dccf69dbeaa88ee66737 (diff)
downloadcpython-6b7dcc56072d19d3edbc905d0bb20bd0b4463d19.zip
cpython-6b7dcc56072d19d3edbc905d0bb20bd0b4463d19.tar.gz
cpython-6b7dcc56072d19d3edbc905d0bb20bd0b4463d19.tar.bz2
gh-92206: Improve scoping of sqlite3 statement helper (#92260)
Diffstat (limited to 'Modules/_sqlite/cursor.c')
-rw-r--r--Modules/_sqlite/cursor.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/Modules/_sqlite/cursor.c b/Modules/_sqlite/cursor.c
index 16bceef..87fed2e 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()) {