Skip to content

Commit f7f0ed5

Browse files
author
Erlend Egeberg Aasland
authored
bpo-40810: Fix CheckTraceCallbackContent for SQLite pre 3.7.15 (GH-20530)
Ref. [SQLite 3.7.15 changelog](https://sqlite.org/changes.html#version_3_7_15): _"Avoid invoking the sqlite3_trace() callback multiple times when a statement is automatically reprepared due to SQLITE_SCHEMA errors."_
1 parent 0b858cd commit f7f0ed5

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
@@ -260,6 +260,14 @@ def trace(statement):
260260
cur.execute(queries[0])
261261
con2.execute("create table bar(x)")
262262
cur.execute(queries[1])
263+
264+
# Extract from SQLite 3.7.15 changelog:
265+
# Avoid invoking the sqlite3_trace() callback multiple times when a
266+
# statement is automatically reprepared due to SQLITE_SCHEMA errors.
267+
#
268+
# See bpo-40810
269+
if sqlite.sqlite_version_info < (3, 7, 15):
270+
queries.append(queries[-1])
263271
self.assertEqual(traced_statements, queries)
264272

265273

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)