Skip to content

Commit 4a7d9a1

Browse files
author
Erlend E. Aasland
committed
Revert "Simplify error handling"
This reverts commit 393368f.
1 parent 393368f commit 4a7d9a1

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

Modules/_sqlite/cursor.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,7 @@ begin_transaction(pysqlite_Connection *self)
407407
Py_END_ALLOW_THREADS
408408

409409
if (rc != SQLITE_OK) {
410+
_pysqlite_seterror(self->db);
410411
goto error;
411412
}
412413

@@ -415,15 +416,15 @@ begin_transaction(pysqlite_Connection *self)
415416
rc = sqlite3_finalize(statement);
416417
Py_END_ALLOW_THREADS
417418

418-
if (rc != SQLITE_OK) {
419-
goto error;
419+
if (rc != SQLITE_OK && !PyErr_Occurred()) {
420+
_pysqlite_seterror(self->db);
420421
}
421422

422-
return 0;
423-
424423
error:
425-
_pysqlite_seterror(self->db);
426-
return -1;
424+
if (PyErr_Occurred()) {
425+
return -1;
426+
}
427+
return 0;
427428
}
428429

429430
static PyObject *

0 commit comments

Comments
 (0)