mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-09 22:49:57 +09:00
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 Signed-off-by: CHOUMnote <rlawlgh1028@naver.com>
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user