summaryrefslogtreecommitdiffstats
path: root/Modules/_sqlite/cursor.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/_sqlite/cursor.c')
-rw-r--r--Modules/_sqlite/cursor.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/Modules/_sqlite/cursor.c b/Modules/_sqlite/cursor.c
index 06ce385..d0c9e7f 100644
--- a/Modules/_sqlite/cursor.c
+++ b/Modules/_sqlite/cursor.c
@@ -431,31 +431,22 @@ static int
begin_transaction(pysqlite_Connection *self)
{
int rc;
- sqlite3_stmt *statement;
Py_BEGIN_ALLOW_THREADS
+ sqlite3_stmt *statement;
rc = sqlite3_prepare_v2(self->db, self->begin_statement, -1, &statement,
NULL);
- Py_END_ALLOW_THREADS
-
- if (rc != SQLITE_OK) {
- _pysqlite_seterror(self->state, self->db);
- goto error;
+ if (rc == SQLITE_OK) {
+ (void)sqlite3_step(statement);
+ rc = sqlite3_finalize(statement);
}
-
- Py_BEGIN_ALLOW_THREADS
- sqlite3_step(statement);
- rc = sqlite3_finalize(statement);
Py_END_ALLOW_THREADS
- if (rc != SQLITE_OK && !PyErr_Occurred()) {
- _pysqlite_seterror(self->state, self->db);
- }
-
-error:
- if (PyErr_Occurred()) {
+ if (rc != SQLITE_OK) {
+ (void)_pysqlite_seterror(self->state, self->db);
return -1;
}
+
return 0;
}