diff --git a/Modules/_sqlite/cursor.c b/Modules/_sqlite/cursor.c index ba6e52db56..9e91a58520 100644 --- a/Modules/_sqlite/cursor.c +++ b/Modules/_sqlite/cursor.c @@ -706,6 +706,17 @@ PyObject* pysqlite_cursor_executescript(pysqlite_Cursor* self, PyObject* args) } Py_DECREF(result); + /* We start a transaction implicitly. */ + if (self->connection->begin_statement) { + if (sqlite3_get_autocommit(self->connection->db)) { + result = _pysqlite_connection_begin(self->connection); + if (!result) { + goto error; + } + Py_DECREF(result); + } + } + while (1) { Py_BEGIN_ALLOW_THREADS rc = SQLITE3_PREPARE(self->connection->db,