mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 18:59:04 +08:00
stdlib(sqlite): Raise ProgrammingError in closed Blob context manager (#6041)
This commit is contained in:
1 parent
89c58d678a
commit
d8f1d188c3
2 files changed
+7
-6
No files matched your search
Vendored
-2
@@ -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)")
|
||||
|
||||
@@ -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>> {
|
||||
|
||||
Reference in new issue
Block a user