bpo-40810: Fix CheckTraceCallbackContent for SQLite pre 3.7.15 (GH-20530)

Ref. [SQLite 3.7.15 changelog](https://sqlite.org/changes.htmlGH-version_3_7_15):
_"Avoid invoking the sqlite3_trace() callback multiple times when a statement is automatically reprepared due to SQLITE_SCHEMA errors."_
(cherry picked from commit f7f0ed59bc)

Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
This commit is contained in:
Miss Islington (bot) 2021-01-04 15:41:03 -08:00 committed by GitHub
parent def7dc3b71
commit 80e5732d31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View File

@ -265,6 +265,14 @@ class TraceCallbackTests(unittest.TestCase):
cur.execute(queries[0]) cur.execute(queries[0])
con2.execute("create table bar(x)") con2.execute("create table bar(x)")
cur.execute(queries[1]) cur.execute(queries[1])
# Extract from SQLite 3.7.15 changelog:
# Avoid invoking the sqlite3_trace() callback multiple times when a
# statement is automatically reprepared due to SQLITE_SCHEMA errors.
#
# See bpo-40810
if sqlite.sqlite_version_info < (3, 7, 15):
queries.append(queries[-1])
self.assertEqual(traced_statements, queries) self.assertEqual(traced_statements, queries)

View File

@ -0,0 +1 @@
In :mod:`sqlite3`, fix `CheckTraceCallbackContent` for SQLite pre 3.7.15.