Skip to content

Commit 9ecc95d

Browse files
committed
PyLease::{into_pyref -> into_owned}
1 parent e214d67 commit 9ecc95d

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

vm/src/builtins/pytype.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ impl GetAttr for PyType {
647647
.is_some()
648648
{
649649
if let Some(descr_get) = attr_class.mro_find_map(|cls| cls.slots.descr_get.load()) {
650-
let mcl = PyLease::into_pyref(mcl).into();
650+
let mcl = PyLease::into_owned(mcl).into();
651651
return descr_get(attr.clone(), Some(zelf.into()), Some(mcl), vm);
652652
}
653653
}
@@ -874,7 +874,7 @@ fn calculate_meta_class(
874874
if winner.fast_issubclass(&base_type) {
875875
continue;
876876
} else if base_type.fast_issubclass(&winner) {
877-
winner = PyLease::into_pyref(base_type);
877+
winner = PyLease::into_owned(base_type);
878878
continue;
879879
}
880880

vm/src/pyobject.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -467,11 +467,9 @@ pub struct PyLease<'a, T: PyObjectPayload> {
467467
}
468468

469469
impl<'a, T: PyObjectPayload + PyValue> PyLease<'a, T> {
470-
// Associated function on purpose, because of deref
471-
#[allow(clippy::wrong_self_convention)]
472470
#[inline(always)]
473-
pub fn into_pyref(zelf: Self) -> PyRef<T> {
474-
zelf.inner.clone()
471+
pub fn into_owned(self) -> PyRef<T> {
472+
self.inner.clone()
475473
}
476474
}
477475

@@ -748,7 +746,7 @@ impl PyMethod {
748746
.is_some()
749747
{
750748
drop(descr_cls);
751-
let cls = PyLease::into_pyref(cls).into();
749+
let cls = PyLease::into_owned(cls).into();
752750
return descr_get(descr, Some(obj), Some(cls), vm).map(Self::Attribute);
753751
}
754752
}
@@ -776,7 +774,7 @@ impl PyMethod {
776774
})
777775
}
778776
Some(descr_get) => {
779-
let cls = PyLease::into_pyref(cls).into();
777+
let cls = PyLease::into_owned(cls).into();
780778
descr_get(attr, Some(obj), Some(cls), vm).map(Self::Attribute)
781779
}
782780
None => Ok(Self::Attribute(attr)),
@@ -817,7 +815,7 @@ impl PyMethod {
817815
drop(obj_cls);
818816
Self::Function { target: obj, func }
819817
} else {
820-
let obj_cls = PyLease::into_pyref(obj_cls).into();
818+
let obj_cls = PyLease::into_owned(obj_cls).into();
821819
let attr = vm
822820
.call_get_descriptor_specific(func, Some(obj), Some(obj_cls))
823821
.unwrap_or_else(Ok)?;

vm/src/vm.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ impl VirtualMachine {
785785
.is_some()
786786
{
787787
drop(descr_cls);
788-
let cls = PyLease::into_pyref(obj_cls).into();
788+
let cls = PyLease::into_owned(obj_cls).into();
789789
return descr_get(descr, Some(obj), Some(cls), self).map(Some);
790790
}
791791
}
@@ -808,7 +808,7 @@ impl VirtualMachine {
808808
} else if let Some((attr, descr_get)) = cls_attr {
809809
match descr_get {
810810
Some(descr_get) => {
811-
let cls = PyLease::into_pyref(obj_cls).into();
811+
let cls = PyLease::into_owned(obj_cls).into();
812812
descr_get(attr, Some(obj), Some(cls), self).map(Some)
813813
}
814814
None => Ok(Some(attr)),

0 commit comments

Comments
 (0)