mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
gh-108590: Fix sqlite3.iterdump for invalid Unicode in TEXT columns (#108657)
Co-authored-by: Erlend E. Aasland <erlend@python.org>
This commit is contained in:
parent
210a5d7b8b
commit
400a1cebc7
3 changed files with 41 additions and 2 deletions
|
@ -133,6 +133,21 @@ class DumpTests(MemoryDatabaseMixin, unittest.TestCase):
|
|||
actual = list(self.cx.iterdump())
|
||||
self.assertEqual(expected, actual)
|
||||
|
||||
def test_dump_unicode_invalid(self):
|
||||
# gh-108590
|
||||
expected = [
|
||||
"BEGIN TRANSACTION;",
|
||||
"CREATE TABLE foo (data TEXT);",
|
||||
"INSERT INTO \"foo\" VALUES('a\x9f');",
|
||||
"COMMIT;",
|
||||
]
|
||||
self.cu.executescript("""
|
||||
CREATE TABLE foo (data TEXT);
|
||||
INSERT INTO foo VALUES (CAST(X'619f' AS TEXT));
|
||||
""")
|
||||
actual = list(self.cx.iterdump())
|
||||
self.assertEqual(expected, actual)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue