From d88fb363089956a229b5ff1697364ace6e33660a Mon Sep 17 00:00:00 2001 From: Jeong Yunwon Date: Mon, 18 Apr 2022 06:02:35 +0900 Subject: [PATCH] call PyLease::into_owned as method --- vm/src/builtins/pytype.rs | 5 ++--- vm/src/pyobject.rs | 6 +++--- vm/src/vm.rs | 5 ++--- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/vm/src/builtins/pytype.rs b/vm/src/builtins/pytype.rs index 78944bdf2..bb6f11c6d 100644 --- a/vm/src/builtins/pytype.rs +++ b/vm/src/builtins/pytype.rs @@ -10,7 +10,6 @@ use crate::common::{ use crate::{ function::{FuncArgs, KwArgs, OptionalArg}, pyclass::{PyClassImpl, StaticType}, - pyobject::PyLease, types::{Callable, GetAttr, PyTypeFlags, PyTypeSlots, SetAttr}, AsPyObject, PyContext, PyObjectRef, PyObjectWeak, PyRef, PyResult, PyValue, VirtualMachine, }; @@ -647,7 +646,7 @@ impl GetAttr for PyType { .is_some() { if let Some(descr_get) = attr_class.mro_find_map(|cls| cls.slots.descr_get.load()) { - let mcl = PyLease::into_owned(mcl).into(); + let mcl = mcl.into_owned().into(); return descr_get(attr.clone(), Some(zelf.into()), Some(mcl), vm); } } @@ -874,7 +873,7 @@ fn calculate_meta_class( if winner.fast_issubclass(&base_type) { continue; } else if base_type.fast_issubclass(&winner) { - winner = PyLease::into_owned(base_type); + winner = base_type.into_owned(); continue; } diff --git a/vm/src/pyobject.rs b/vm/src/pyobject.rs index bf8943604..2cc44873a 100644 --- a/vm/src/pyobject.rs +++ b/vm/src/pyobject.rs @@ -746,7 +746,7 @@ impl PyMethod { .is_some() { drop(descr_cls); - let cls = PyLease::into_owned(cls).into(); + let cls = cls.into_owned().into(); return descr_get(descr, Some(obj), Some(cls), vm).map(Self::Attribute); } } @@ -774,7 +774,7 @@ impl PyMethod { }) } Some(descr_get) => { - let cls = PyLease::into_owned(cls).into(); + let cls = cls.into_owned().into(); descr_get(attr, Some(obj), Some(cls), vm).map(Self::Attribute) } None => Ok(Self::Attribute(attr)), @@ -815,7 +815,7 @@ impl PyMethod { drop(obj_cls); Self::Function { target: obj, func } } else { - let obj_cls = PyLease::into_owned(obj_cls).into(); + let obj_cls = obj_cls.into_owned().into(); let attr = vm .call_get_descriptor_specific(func, Some(obj), Some(obj_cls)) .unwrap_or_else(Ok)?; diff --git a/vm/src/vm.rs b/vm/src/vm.rs index a4f5f42b2..b5c3b5ec0 100644 --- a/vm/src/vm.rs +++ b/vm/src/vm.rs @@ -23,7 +23,6 @@ use crate::{ function::{ArgMapping, FuncArgs}, import, protocol::PyIterIter, - pyobject::PyLease, scope::Scope, signal, stdlib, AsPyObject, PyContext, PyObject, PyObjectRef, PyRef, PyRefExact, PyResult, PyValue, @@ -785,7 +784,7 @@ impl VirtualMachine { .is_some() { drop(descr_cls); - let cls = PyLease::into_owned(obj_cls).into(); + let cls = obj_cls.into_owned().into(); return descr_get(descr, Some(obj), Some(cls), self).map(Some); } } @@ -808,7 +807,7 @@ impl VirtualMachine { } else if let Some((attr, descr_get)) = cls_attr { match descr_get { Some(descr_get) => { - let cls = PyLease::into_owned(obj_cls).into(); + let cls = obj_cls.into_owned().into(); descr_get(attr, Some(obj), Some(cls), self).map(Some) } None => Ok(Some(attr)),