summaryrefslogtreecommitdiffstats
path: root/Lib/sqlite3/dump.py
diff options
context:
space:
mode:
authorErlend E. Aasland <erlend@python.org>2024-04-25 08:11:45 (GMT)
committerGitHub <noreply@github.com>2024-04-25 08:11:45 (GMT)
commite38b43c213a8ab2ad9748bac2732af9b58c816ae (patch)
treef3244a81e7f38983d6f09dea67e9ec418deff1ef /Lib/sqlite3/dump.py
parent796b3fb28057948ea5b98f7eb0c0f3af6a1e276e (diff)
downloadcpython-e38b43c213a8ab2ad9748bac2732af9b58c816ae.zip
cpython-e38b43c213a8ab2ad9748bac2732af9b58c816ae.tar.gz
cpython-e38b43c213a8ab2ad9748bac2732af9b58c816ae.tar.bz2
gh-118221: Always use the default row factory in sqlite3.iterdump() (#118223)
sqlite3.iterdump() depends on the row factory returning resulting rows as tuples; it will fail with custom row factories like for example a dict factory. With this commit, we explicitly reset the row factory of the cursor used by iterdump(), so we always get predictable results. This does not affect the row factory of the parent connection. Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Diffstat (limited to 'Lib/sqlite3/dump.py')
-rw-r--r--Lib/sqlite3/dump.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/Lib/sqlite3/dump.py b/Lib/sqlite3/dump.py
index 9dcce7d..57e6a3b 100644
--- a/Lib/sqlite3/dump.py
+++ b/Lib/sqlite3/dump.py
@@ -26,6 +26,7 @@ def _iterdump(connection, *, filter=None):
writeable_schema = False
cu = connection.cursor()
+ cu.row_factory = None # Make sure we get predictable results.
# Disable foreign key constraints, if there is any foreign key violation.
violations = cu.execute("PRAGMA foreign_key_check").fetchall()
if violations: