summaryrefslogtreecommitdiffstats
path: root/Lib/sqlite3/test/hooks.py
diff options
context:
space:
mode:
authorErlend Egeberg Aasland <erlend.aasland@innova.no>2021-01-04 23:16:43 (GMT)
committerGitHub <noreply@github.com>2021-01-04 23:16:43 (GMT)
commitf7f0ed59bcc41ed20674d4b2aa443d3b79e725f4 (patch)
tree5f289ee75224a87baa8a564e398dde8f3af1043f /Lib/sqlite3/test/hooks.py
parent0b858cdd5d114f0890b11b6c4d6559d0ceb468ab (diff)
downloadcpython-f7f0ed59bcc41ed20674d4b2aa443d3b79e725f4.zip
cpython-f7f0ed59bcc41ed20674d4b2aa443d3b79e725f4.tar.gz
cpython-f7f0ed59bcc41ed20674d4b2aa443d3b79e725f4.tar.bz2
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."_
Diffstat (limited to 'Lib/sqlite3/test/hooks.py')
-rw-r--r--Lib/sqlite3/test/hooks.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/sqlite3/test/hooks.py b/Lib/sqlite3/test/hooks.py
index 2e620ec..6c1aaa2 100644
--- a/Lib/sqlite3/test/hooks.py
+++ b/Lib/sqlite3/test/hooks.py
@@ -260,6 +260,14 @@ class TraceCallbackTests(unittest.TestCase):
cur.execute(queries[0])
con2.execute("create table bar(x)")
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)