Skip to content

Commit e0f7fbb

Browse files
committed
Don't derive FromArgs on payload type.
1 parent a49895e commit e0f7fbb

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

vm/src/obj/objslice.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
1-
use crate::function::PyFuncArgs;
1+
use crate::function::{OptionalArg, PyFuncArgs};
22
use crate::pyobject::{IdProtocol, PyContext, PyObjectRef, PyRef, PyResult, PyValue, TypeProtocol};
33
use crate::vm::VirtualMachine;
44

55
use crate::obj::objint::PyInt;
66
use crate::obj::objtype::{class_has_attr, PyClassRef};
77
use num_bigint::BigInt;
88

9-
#[derive(Debug, FromArgs)]
9+
#[derive(Debug)]
1010
pub struct PySlice {
11-
#[pyarg(positional_only)]
1211
pub start: Option<PyObjectRef>,
13-
#[pyarg(positional_only)]
1412
pub stop: Option<PyObjectRef>,
15-
#[pyarg(positional_only, default)]
1613
pub step: Option<PyObjectRef>,
1714
}
1815

@@ -37,7 +34,15 @@ fn slice_new(cls: PyClassRef, args: PyFuncArgs, vm: &VirtualMachine) -> PyResult
3734
step: None,
3835
}
3936
}
40-
_ => args.bind(vm)?,
37+
_ => {
38+
let (start, stop, step): (PyObjectRef, PyObjectRef, OptionalArg<PyObjectRef>) =
39+
args.bind(vm)?;
40+
PySlice {
41+
start: Some(start),
42+
stop: Some(stop),
43+
step: step.into_option(),
44+
}
45+
}
4146
};
4247
slice.into_ref_with_type(vm, cls)
4348
}

0 commit comments

Comments
 (0)