Skip to content

Commit d305d4f

Browse files
committed
Clean up a bit
1 parent c0e5727 commit d305d4f

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed

vm/src/obj/objobject.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ use crate::vm::VirtualMachine;
1212
pub struct PyInstance;
1313

1414
impl PyValue for PyInstance {
15-
fn required_type(_ctx: &PyContext) -> PyObjectRef {
16-
panic!("no specific type for PyInstance, don't type check me")
15+
fn required_type(ctx: &PyContext) -> PyObjectRef {
16+
ctx.object()
1717
}
1818
}
1919

vm/src/pyobject.rs

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1567,21 +1567,9 @@ pub trait PyValue: fmt::Debug + 'static {
15671567
fn required_type(ctx: &PyContext) -> PyObjectRef;
15681568
}
15691569

1570-
pub trait PyObjectPayload: Any + fmt::Debug + 'static {
1571-
fn required_type(&self, ctx: &PyContext) -> PyObjectRef;
1572-
}
1573-
1574-
impl<T: PyValue + 'static> PyObjectPayload for T {
1575-
fn required_type(&self, ctx: &PyContext) -> PyObjectRef {
1576-
T::required_type(ctx)
1577-
}
1578-
}
1570+
pub trait PyObjectPayload: Any + fmt::Debug + 'static {}
15791571

1580-
impl PyObjectPayload for () {
1581-
fn required_type(&self, _ctx: &PyContext) -> PyObjectRef {
1582-
panic!("No specific python type for rust unit, don't type check")
1583-
}
1584-
}
1572+
impl<T: PyValue + 'static> PyObjectPayload for T {}
15851573

15861574
impl FromPyObjectRef for PyRef<PyClass> {
15871575
fn from_pyobj(obj: &PyObjectRef) -> Self {

0 commit comments

Comments
 (0)