diff --git a/Lib/test/test_slice.py b/Lib/test/test_slice.py index ecdd92b6c..9e79775ac 100644 --- a/Lib/test/test_slice.py +++ b/Lib/test/test_slice.py @@ -234,8 +234,6 @@ class SliceTest(unittest.TestCase): x[1:2] = 42 self.assertEqual(tmp, [(slice(1, 2), 42)]) - # TODO: RUSTPYTHON - @unittest.expectedFailure def test_pickle(self): s = slice(10, 20, 3) for protocol in (0,1,2): diff --git a/vm/src/builtins/slice.rs b/vm/src/builtins/slice.rs index 99bcec732..68e5d6886 100644 --- a/vm/src/builtins/slice.rs +++ b/vm/src/builtins/slice.rs @@ -194,6 +194,20 @@ impl PySlice { let (start, stop, step) = self.inner_indices(length, vm)?; Ok(vm.new_tuple((start, stop, step))) } + + #[allow(clippy::type_complexity)] + #[pymethod(magic)] + fn reduce( + zelf: PyRef, + ) -> PyResult<( + PyTypeRef, + (Option, PyObjectRef, Option), + )> { + Ok(( + zelf.clone_class(), + (zelf.start.clone(), zelf.stop.clone(), zelf.step.clone()), + )) + } } impl Comparable for PySlice {