stdlib(sqlite): Raise ProgrammingError in closed Blob context manager (#6041)

This commit is contained in:
Jiseok CHOI authored and GitHub committed 2025-07-27 21:47:05 +09:00
1 parent 89c58d678a
commit d8f1d188c3
2 files changed
+7 -6

No files matched your search

-2
View File
@@ -1452,8 +1452,6 @@ class BlobTests(unittest.TestCase):
raise DummyException("reraised")
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_blob_closed(self):
with memory_database() as cx:
cx.execute("create table test(b blob)")
+7 -4
View File
@@ -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>> {