mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 18:59:04 +08:00
added __reduce__ method for itertools.permutations
This commit is contained in:
1 parent
d5a62848dd
commit
94029386ae
1 file changed
+9
-1
@@ -1670,7 +1670,15 @@ mod decl {
|
||||
}
|
||||
|
||||
#[pyclass(with(IterNext, Iterable, Constructor))]
|
||||
impl PyItertoolsPermutations {}
|
||||
impl PyItertoolsPermutations {
|
||||
#[pymethod(magic)]
|
||||
fn reduce(zelf: PyRef<Self>, vm: &VirtualMachine) -> PyRef<PyTuple> {
|
||||
vm.new_tuple((
|
||||
zelf.class().to_owned(),
|
||||
vm.new_tuple((zelf.pool.clone(), vm.ctx.new_int(zelf.r.load()))),
|
||||
))
|
||||
}
|
||||
}
|
||||
impl SelfIter for PyItertoolsPermutations {}
|
||||
impl IterNext for PyItertoolsPermutations {
|
||||
fn next(zelf: &Py<Self>, vm: &VirtualMachine) -> PyResult<PyIterReturn> {
|
||||
|
||||
Reference in new issue
Block a user