Skip to content

Commit 65faf5f

Browse files
committed
Use FuncArgs in _testinternalcapi hamt and InstructionSequence constructors
Both types drop their slot_new overrides and take FuncArgs in py_new. Behavior is unchanged. Assisted-by: Claude:claude-opus-5-5 Assisted-by: Grok:grok-4.7
1 parent 942c623 commit 65faf5f

1 file changed

Lines changed: 4 additions & 12 deletions

File tree

‎crates/vm/src/stdlib/_testinternalcapi.rs‎

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -884,13 +884,9 @@ mod _testinternalcapi {
884884
}
885885

886886
impl Constructor for Hamt {
887-
type Args = ();
888-
889-
fn slot_new(cls: PyTypeRef, _args: FuncArgs, vm: &VirtualMachine) -> PyResult {
890-
Self::default().into_ref_with_type(vm, cls).map(Into::into)
891-
}
887+
type Args = FuncArgs;
892888

893-
fn py_new(_cls: &Py<PyType>, _args: Self::Args, _vm: &VirtualMachine) -> PyResult<Self> {
889+
fn py_new(_cls: &Py<PyType>, _args: FuncArgs, _vm: &VirtualMachine) -> PyResult<Self> {
894890
Ok(Self::default())
895891
}
896892
}
@@ -1242,9 +1238,9 @@ mod _testinternalcapi {
12421238

12431239
#[cfg(feature = "codegen")]
12441240
impl Constructor for PyInstructionSequence {
1245-
type Args = ();
1241+
type Args = FuncArgs;
12461242

1247-
fn slot_new(cls: PyTypeRef, args: FuncArgs, vm: &VirtualMachine) -> PyResult {
1243+
fn py_new(cls: &Py<PyType>, args: FuncArgs, vm: &VirtualMachine) -> PyResult<Self> {
12481244
if cls.is(Self::class(&vm.ctx)) {
12491245
if !args.args.is_empty() {
12501246
return Err(vm.new_type_error(
@@ -1257,10 +1253,6 @@ mod _testinternalcapi {
12571253
);
12581254
}
12591255
}
1260-
Self::empty().into_ref_with_type(vm, cls).map(Into::into)
1261-
}
1262-
1263-
fn py_new(_cls: &Py<PyType>, _args: Self::Args, _vm: &VirtualMachine) -> PyResult<Self> {
12641256
Ok(Self::empty())
12651257
}
12661258
}

0 commit comments

Comments
 (0)