diff -r 598a00a4540a Lib/sqlite3/test/transactions.py --- a/Lib/sqlite3/test/transactions.py Fri Dec 16 10:00:53 2016 +0100 +++ b/Lib/sqlite3/test/transactions.py Fri Dec 16 14:53:07 2016 +0200 @@ -179,6 +179,15 @@ class TransactionalDDL(unittest.TestCase result = self.con.execute("select * from test").fetchall() self.assertEqual(result, []) + def CheckImmediateTransactionalDDL(self): + # You can achieve transactional DDL by issuing a BEGIN + # statement manually. + self.con.execute("begin immediate") + self.con.execute("create table test(i)") + self.con.rollback() + with self.assertRaises(sqlite.OperationalError): + self.con.execute("select * from test") + def CheckTransactionalDDL(self): # You can achieve transactional DDL by issuing a BEGIN # statement manually. diff -r 598a00a4540a Modules/_sqlite/statement.c --- a/Modules/_sqlite/statement.c Fri Dec 16 10:00:53 2016 +0100 +++ b/Modules/_sqlite/statement.c Fri Dec 16 14:53:07 2016 +0200 @@ -86,7 +86,8 @@ int pysqlite_statement_create(pysqlite_S self->is_ddl = (PyOS_strnicmp(p, "create ", 7) == 0) || (PyOS_strnicmp(p, "drop ", 5) == 0) - || (PyOS_strnicmp(p, "reindex ", 8) == 0); + || (PyOS_strnicmp(p, "reindex ", 8) == 0) + || (PyOS_strnicmp(p, "begin ", 6) == 0); break; }