def test_cast_instance_to_base_obj(self): class X(object): pass x = X() obj = annlowlevel.cast_instance_to_base_obj(x) assert lltype.typeOf(obj) == annlowlevel.base_obj_ootype() y = annlowlevel.cast_base_ptr_to_instance(X, obj) assert y is x
def _cast_instance_to_native_obj(self, e): from pypy.rpython.annlowlevel import cast_instance_to_base_obj inst = cast_instance_to_base_obj(e) # SomeOOInstance obj = ootype.cast_to_object(inst) # SomeOOObject return dotnet.cast_to_native_object(obj) # System.Object