call PyLease::into_owned as method

This commit is contained in:
Jeong Yunwon
2022-04-18 06:02:35 +09:00
parent 659c1b8254
commit d88fb36308
3 changed files with 7 additions and 9 deletions

View File

@@ -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;
}

View File

@@ -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)?;

View File

@@ -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)),