diff options
| author | R David Murray <rdmurray@bitdance.com> | 2013-01-10 16:15:57 (GMT) |
|---|---|---|
| committer | R David Murray <rdmurray@bitdance.com> | 2013-01-10 16:15:57 (GMT) |
| commit | 96983afd0cedf7347965d1fc6af388cf3dc88976 (patch) | |
| tree | d4edc352e7387fa8ebe9cbf3a4f2b343ec85fe3a /Lib/sqlite3/dump.py | |
| parent | 15d24b7c4c993fc0320e9ce906b41bdaec5d8bc2 (diff) | |
| parent | 7bd04867e53d78ddb0f5e8f78b9256298d41fadd (diff) | |
| download | cpython-96983afd0cedf7347965d1fc6af388cf3dc88976.zip cpython-96983afd0cedf7347965d1fc6af388cf3dc88976.tar.gz cpython-96983afd0cedf7347965d1fc6af388cf3dc88976.tar.bz2 | |
merge #15545: fix sqlite3.iterdump regression on unsortable row_factory objects.
The fix for issue 9750 introduced a regression by sorting the row objects
returned by fetchall. But if a row_factory such as sqlite3.Row is used, the
rows may not be sortable (in Python3), which leads to an exception. The
sorting is still a nice idea, so the patch moves the sort into the sql.
Fix and test by Peter Otten.
Diffstat (limited to 'Lib/sqlite3/dump.py')
| -rw-r--r-- | Lib/sqlite3/dump.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/sqlite3/dump.py b/Lib/sqlite3/dump.py index da6be68..de9c368 100644 --- a/Lib/sqlite3/dump.py +++ b/Lib/sqlite3/dump.py @@ -25,9 +25,10 @@ def _iterdump(connection): FROM "sqlite_master" WHERE "sql" NOT NULL AND "type" == 'table' + ORDER BY "name" """ schema_res = cu.execute(q) - for table_name, type, sql in sorted(schema_res.fetchall()): + for table_name, type, sql in schema_res.fetchall(): if table_name == 'sqlite_sequence': yield('DELETE FROM "sqlite_sequence";') elif table_name == 'sqlite_stat1': |
