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
stdlib(sqlite): Raise ProgrammingError in closed Blob context manager
  • Loading branch information
ever0de committed Jul 27, 2025
commit ac08f65705c616cf9da66571d825d9a4280c5b3d
2 changes: 0 additions & 2 deletions Lib/test/test_sqlite3/test_dbapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -1452,8 +1452,6 @@ class DummyException(Exception):
raise DummyException("reraised")


# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_blob_closed(self):
with memory_database() as cx:
cx.execute("create table test(b blob)")
Expand Down
11 changes: 7 additions & 4 deletions stdlib/src/sqlite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2145,13 +2145,16 @@ mod _sqlite {
}

#[pymethod]
fn __enter__(zelf: PyRef<Self>) -> PyRef<Self> {
zelf
fn __enter__(zelf: PyRef<Self>, vm: &VirtualMachine) -> PyResult<PyRef<Self>> {
let _ = zelf.inner(vm)?;
Ok(zelf)
}

#[pymethod]
fn __exit__(&self, _args: FuncArgs) {
self.close()
fn __exit__(&self, _args: FuncArgs, vm: &VirtualMachine) -> PyResult<()> {
let _ = self.inner(vm)?;
self.close();
Ok(())
}

fn inner(&self, vm: &VirtualMachine) -> PyResult<PyMappedMutexGuard<'_, BlobInner>> {
Expand Down
Loading