Skip to content

Commit 393368f

Browse files
author
Erlend E. Aasland
committed
Simplify error handling
1 parent 891ebce commit 393368f

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

Modules/_sqlite/cursor.c

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

409409
if (rc != SQLITE_OK) {
410-
_pysqlite_seterror(self->db);
411410
goto error;
412411
}
413412

@@ -416,15 +415,15 @@ begin_transaction(pysqlite_Connection *self)
416415
rc = sqlite3_finalize(statement);
417416
Py_END_ALLOW_THREADS
418417

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

423-
error:
424-
if (PyErr_Occurred()) {
425-
return -1;
426-
}
427422
return 0;
423+
424+
error:
425+
_pysqlite_seterror(self->db);
426+
return -1;
428427
}
429428

430429
static PyObject *

0 commit comments

Comments
 (0)