From 418addcffaf678014ddd143ed8ff266959b710a6 Mon Sep 17 00:00:00 2001 From: Noah <33094578+coolreader18@users.noreply.github.com> Date: Tue, 1 Oct 2019 21:23:17 +0000 Subject: [PATCH] Fix properties on the type type --- vm/src/obj/objproperty.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/vm/src/obj/objproperty.rs b/vm/src/obj/objproperty.rs index 776f06af9..2e105bd50 100644 --- a/vm/src/obj/objproperty.rs +++ b/vm/src/obj/objproperty.rs @@ -28,13 +28,10 @@ pub type PyReadOnlyPropertyRef = PyRef; #[pyimpl] impl PyReadOnlyProperty { #[pymethod(name = "__get__")] - fn get( - zelf: PyRef, - obj: PyObjectRef, - _owner: OptionalArg, - vm: &VirtualMachine, - ) -> PyResult { - if obj.is(vm.ctx.none.as_object()) { + fn get(zelf: PyRef, obj: PyObjectRef, cls: PyClassRef, vm: &VirtualMachine) -> PyResult { + if cls.is(&vm.ctx.types.type_type) { + vm.invoke(&zelf.getter, cls.into_object()) + } else if vm.is_none(&obj) { Ok(zelf.into_object()) } else { vm.invoke(&zelf.getter, obj)