Make PyWeak::downgrade take a reference
@@ -11,9 +11,9 @@ pub struct PyWeak {
}
impl PyWeak {
- pub fn downgrade(obj: PyObjectRef) -> PyWeak {
+ pub fn downgrade(obj: &PyObjectRef) -> PyWeak {
PyWeak {
- referent: Rc::downgrade(&obj),
+ referent: Rc::downgrade(obj),
}
}
@@ -33,7 +33,7 @@ pub type PyWeakRef = PyRef<PyWeak>;
impl PyWeakRef {
// TODO callbacks
fn create(cls: PyClassRef, referent: PyObjectRef, vm: &VirtualMachine) -> PyResult<Self> {
- PyWeak::downgrade(referent).into_ref_with_type(vm, cls)
+ PyWeak::downgrade(&referent).into_ref_with_type(vm, cls)
}
fn call(self, vm: &VirtualMachine) -> PyObjectRef {
