mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-09 22:49:57 +09:00
Fix properties on the type type
This commit is contained in:
@@ -28,13 +28,10 @@ pub type PyReadOnlyPropertyRef = PyRef<PyReadOnlyProperty>;
|
||||
#[pyimpl]
|
||||
impl PyReadOnlyProperty {
|
||||
#[pymethod(name = "__get__")]
|
||||
fn get(
|
||||
zelf: PyRef<Self>,
|
||||
obj: PyObjectRef,
|
||||
_owner: OptionalArg<PyClassRef>,
|
||||
vm: &VirtualMachine,
|
||||
) -> PyResult {
|
||||
if obj.is(vm.ctx.none.as_object()) {
|
||||
fn get(zelf: PyRef<Self>, 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)
|
||||
|
||||
Reference in New Issue
Block a user