Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Lib/test/test_sqlite3/test_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,6 @@ def test_invalid_isolation_level_type(self):
sqlite.connect, ":memory:", isolation_level=123)


# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_null_character(self):
# Issue #21147
cur = self.con.cursor()
Expand Down
6 changes: 6 additions & 0 deletions stdlib/src/sqlite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2295,6 +2295,12 @@ mod _sqlite {
vm: &VirtualMachine,
) -> PyResult<Option<Self>> {
let sql = sql.try_into_utf8(vm)?;
if sql.as_str().contains('\0') {
return Err(new_programming_error(
vm,
"statement contains a null character.".to_owned(),
));
}
let sql_cstr = sql.to_cstring(vm)?;
let sql_len = sql.byte_len() + 1;

Expand Down
Loading