Use into_ref_with_type()

This commit is contained in:
j30ng committed 2019-09-14 12:02:05 +09:00
1 parent f920982755
commit d4e5d76441
1 file changed
+4 -5
+4 -5
View File
@@ -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__")]