mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-29 03:04:38 +08:00
Use into_ref_with_type()
This commit is contained in:
1 parent
f920982755
commit
d4e5d76441
1 file changed
+4
-5
@@ -556,20 +556,19 @@ impl PyItertoolsAccumulate {
|
||||
#[pymethod(name = "__new__")]
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
fn new(
|
||||
_cls: PyClassRef,
|
||||
cls: PyClassRef,
|
||||
iterable: PyObjectRef,
|
||||
binop: OptionalArg<PyObjectRef>,
|
||||
vm: &VirtualMachine,
|
||||
) -> PyResult {
|
||||
) -> PyResult<PyRef<PyItertoolsAccumulate>> {
|
||||
let iter = get_iter(vm, &iterable)?;
|
||||
|
||||
Ok(PyItertoolsAccumulate {
|
||||
PyItertoolsAccumulate {
|
||||
iterable: iter,
|
||||
binop: binop.unwrap_or_else(|| vm.get_none()),
|
||||
acc_value: RefCell::from(Option::None),
|
||||
}
|
||||
.into_ref(vm)
|
||||
.into_object())
|
||||
.into_ref_with_type(vm, cls)
|
||||
}
|
||||
|
||||
#[pymethod(name = "__next__")]
|
||||
|
||||
Reference in new issue
Block a user