add __str__ in PyWeakProxy
file : test_deque.py
method : test_weakref()
error occurred because the return value of str() was different
so add __str__() in weakproxy
@@ -70,6 +70,16 @@ impl PyWeakProxy {
})?;
obj.get_attr(attr_name, vm)
}
+ #[pymethod(magic)]
+ fn str(&self, vm: &VirtualMachine) -> PyResult<PyStrRef> {
+ match self.weak.upgrade() {
+ Some(obj) => obj.str(vm),
+ None => Err(vm.new_exception_msg(
+ vm.ctx.exceptions.reference_error.clone(),
+ "weakly-referenced object no longer exists".to_owned(),
+ )),
+ }
+ }
}
impl SetAttr for PyWeakProxy {
