Merge pull request #2700 from DimitrisJim/bound_repr

Fallback to __name__ if __qualname__ isn't available.
This commit is contained in:
Jeong YunWon
2021-06-12 00:10:32 +09:00
committed by GitHub

View File

@@ -453,7 +453,7 @@ impl PyBoundMethod {
if let Some(qname) = vm.get_attribute_opt(self.function.clone(), "__qualname__")? {
Some(qname)
} else {
vm.get_attribute_opt(self.function.clone(), "__qualname__")?
vm.get_attribute_opt(self.function.clone(), "__name__")?
};
let funcname: Option<PyStrRef> = funcname.and_then(|o| o.downcast().ok());
Ok(format!(