diff --git a/vm/src/protocol/object.rs b/vm/src/protocol/object.rs index 639e24dda5d..15a90c24b03 100644 --- a/vm/src/protocol/object.rs +++ b/vm/src/protocol/object.rs @@ -552,8 +552,14 @@ impl PyObject { // type protocol // PyObject *PyObject_Type(PyObject *o) + pub fn obj_type(&self) -> PyObjectRef { + self.class().to_owned().into() + } // int PyObject_TypeCheck(PyObject *o, PyTypeObject *type) + pub fn type_check(&self, typ: PyTypeRef) -> bool { + self.class().fast_isinstance(&typ) + } pub fn length_opt(&self, vm: &VirtualMachine) -> Option> { self.to_sequence(vm)