| 1310 | impl Representable for PyBoundMethod { |
| 1311 | #[inline] |
| 1312 | fn repr_wtf8(zelf: &Py<Self>, vm: &VirtualMachine) -> PyResult<Wtf8Buf> { |
| 1313 | let func_name = if let Some(qname) = |
| 1314 | vm.get_attribute_opt(zelf.function.clone(), identifier!(vm, __qualname__))? |
| 1315 | { |
| 1316 | Some(qname) |
| 1317 | } else { |
| 1318 | vm.get_attribute_opt(zelf.function.clone(), identifier!(vm, __name__))? |
| 1319 | }; |
| 1320 | let func_name: Option<PyStrRef> = func_name.and_then(|o| o.downcast().ok()); |
| 1321 | let object_repr = zelf.object.repr(vm)?; |
| 1322 | let name = func_name.as_ref().map_or("?".as_ref(), |s| s.as_wtf8()); |
| 1323 | Ok(wtf8_concat!( |
| 1324 | "<bound method ", |
| 1325 | name, |
| 1326 | " of ", |
| 1327 | object_repr.as_wtf8(), |
| 1328 | ">" |
| 1329 | )) |
| 1330 | } |
| 1331 | } |
| 1332 | |
| 1333 | #[pyclass(module = false, name = "cell", traverse)] |