Skip to content

Commit bcf5627

Browse files
authored
Raise UnicodeEncodeError for surrogates in sqlite.executescript (#6024)
1 parent 6bce5e1 commit bcf5627

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Lib/test/test_sqlite3/test_dbapi.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1655,8 +1655,6 @@ def test_cursor_executescript_with_null_characters(self):
16551655
insert into a(i) values (5);
16561656
""")
16571657

1658-
# TODO: RUSTPYTHON
1659-
@unittest.expectedFailure
16601658
def test_cursor_executescript_with_surrogates(self):
16611659
con = sqlite.connect(":memory:")
16621660
cur = con.cursor()

stdlib/src/sqlite.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1640,6 +1640,8 @@ mod _sqlite {
16401640
script: PyStrRef,
16411641
vm: &VirtualMachine,
16421642
) -> PyResult<PyRef<Self>> {
1643+
script.ensure_valid_utf8(vm)?;
1644+
16431645
let db = zelf.connection.db_lock(vm)?;
16441646

16451647
db.sql_limit(script.byte_len(), vm)?;

0 commit comments

Comments
 (0)