[3.12] gh-118221: Always use the default row factory in sqlite3.iterdump() (#118223) (#118270)

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>
This commit is contained in:
Erlend E. Aasland 2024-04-25 10:33:35 +02:00 committed by GitHub
parent fc1732ce3f
commit 7a843e8390
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 18 additions and 0 deletions

View file

@ -18,6 +18,7 @@ def _iterdump(connection):
writeable_schema = False
cu = connection.cursor()
cu.row_factory = None # Make sure we get predictable results.
yield('BEGIN TRANSACTION;')
# sqlite_master table contains the SQL CREATE statements for the database.