Skip to content

Commit 5c84fb7

Browse files
authored
Merge branch 'RustPython:main' into main
2 parents 03bb97e + 57029f6 commit 5c84fb7

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

Lib/test/test_sqlite3/test_dbapi.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1452,8 +1452,6 @@ class DummyException(Exception):
14521452
raise DummyException("reraised")
14531453

14541454

1455-
# TODO: RUSTPYTHON
1456-
@unittest.expectedFailure
14571455
def test_blob_closed(self):
14581456
with memory_database() as cx:
14591457
cx.execute("create table test(b blob)")

stdlib/src/sqlite.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2145,13 +2145,16 @@ mod _sqlite {
21452145
}
21462146

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

21522153
#[pymethod]
2153-
fn __exit__(&self, _args: FuncArgs) {
2154-
self.close()
2154+
fn __exit__(&self, _args: FuncArgs, vm: &VirtualMachine) -> PyResult<()> {
2155+
let _ = self.inner(vm)?;
2156+
self.close();
2157+
Ok(())
21552158
}
21562159

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

vm/src/stdlib/itertools.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,7 @@ mod decl {
666666
}
667667
}
668668

669+
#[derive(Default)]
669670
struct GroupByState {
670671
current_value: Option<PyObjectRef>,
671672
current_key: Option<PyObjectRef>,
@@ -729,12 +730,7 @@ mod decl {
729730
Self {
730731
iterable,
731732
key_func: key.flatten(),
732-
state: PyMutex::new(GroupByState {
733-
current_key: None,
734-
current_value: None,
735-
next_group: false,
736-
grouper: None,
737-
}),
733+
state: PyMutex::new(GroupByState::default()),
738734
}
739735
.into_ref_with_type(vm, cls)
740736
.map(Into::into)

0 commit comments

Comments
 (0)