Skip to content

Commit e3c7a53

Browse files
Erlend Egeberg Aaslandadorilson
authored andcommitted
bpo-40810: Fix CheckTraceCallbackContent for SQLite pre 3.7.15 (pythonGH-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 42e5f6b commit e3c7a53

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

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)