Skip to content

Commit 80e5732

Browse files
miss-islingtonErlend Egeberg Aasland
andauthored
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 f7f0ed5) Co-authored-by: Erlend Egeberg Aasland <[email protected]>
1 parent def7dc3 commit 80e5732

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

Lib/sqlite3/test/hooks.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,14 @@ def trace(statement):
265265
cur.execute(queries[0])
266266
con2.execute("create table bar(x)")
267267
cur.execute(queries[1])
268+
269+
# Extract from SQLite 3.7.15 changelog:
270+
# Avoid invoking the sqlite3_trace() callback multiple times when a
271+
# statement is automatically reprepared due to SQLITE_SCHEMA errors.
272+
#
273+
# See bpo-40810
274+
if sqlite.sqlite_version_info < (3, 7, 15):
275+
queries.append(queries[-1])
268276
self.assertEqual(traced_statements, queries)
269277

270278

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
In :mod:`sqlite3`, fix `CheckTraceCallbackContent` for SQLite pre 3.7.15.

0 commit comments

Comments
 (0)