]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-40810: Fix CheckTraceCallbackContent for SQLite pre 3.7.15 (GH-20530)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 4 Jan 2021 23:36:37 +0000 (15:36 -0800)
committerGitHub <noreply@github.com>
Mon, 4 Jan 2021 23:36:37 +0000 (15:36 -0800)
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 f7f0ed59bcc41ed20674d4b2aa443d3b79e725f4)

Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
Lib/sqlite3/test/hooks.py
Misc/NEWS.d/next/Tests/2020-05-30-10-56-38.bpo-40810.LPqDLQ.rst [new file with mode: 0644]

index d74e74bf2722754256cf82b55d9a90f174115072..214205c1167a411acc058c5b246168148bcd2fc4 100644 (file)
@@ -265,6 +265,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)
 
 
diff --git a/Misc/NEWS.d/next/Tests/2020-05-30-10-56-38.bpo-40810.LPqDLQ.rst b/Misc/NEWS.d/next/Tests/2020-05-30-10-56-38.bpo-40810.LPqDLQ.rst
new file mode 100644 (file)
index 0000000..1965ecd
--- /dev/null
@@ -0,0 +1 @@
+In :mod:`sqlite3`, fix `CheckTraceCallbackContent` for SQLite pre 3.7.15.