Skip to content

Commit d4e5d76

Browse files
author
j30ng
committed
Use into_ref_with_type()
1 parent f920982 commit d4e5d76

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

vm/src/stdlib/itertools.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -556,20 +556,19 @@ impl PyItertoolsAccumulate {
556556
#[pymethod(name = "__new__")]
557557
#[allow(clippy::new_ret_no_self)]
558558
fn new(
559-
_cls: PyClassRef,
559+
cls: PyClassRef,
560560
iterable: PyObjectRef,
561561
binop: OptionalArg<PyObjectRef>,
562562
vm: &VirtualMachine,
563-
) -> PyResult {
563+
) -> PyResult<PyRef<PyItertoolsAccumulate>> {
564564
let iter = get_iter(vm, &iterable)?;
565565

566-
Ok(PyItertoolsAccumulate {
566+
PyItertoolsAccumulate {
567567
iterable: iter,
568568
binop: binop.unwrap_or_else(|| vm.get_none()),
569569
acc_value: RefCell::from(Option::None),
570570
}
571-
.into_ref(vm)
572-
.into_object())
571+
.into_ref_with_type(vm, cls)
573572
}
574573

575574
#[pymethod(name = "__next__")]

0 commit comments

Comments
 (0)