(zelf: &Py<Self>, vm: &VirtualMachine)
| 1912 | |
| 1913 | impl Representable for PyTask { |
| 1914 | fn repr_wtf8(zelf: &Py<Self>, vm: &VirtualMachine) -> PyResult<Wtf8Buf> { |
| 1915 | let class_name = zelf.class().name().to_string(); |
| 1916 | |
| 1917 | if let Some(_guard) = ReprGuard::enter(vm, zelf.as_object()) { |
| 1918 | // Try to use _task_repr_info if available |
| 1919 | if let Ok(info) = get_task_repr_info(zelf.as_object(), vm) |
| 1920 | && info.as_bytes() != b"state=unknown" |
| 1921 | { |
| 1922 | return Ok(wtf8_concat!("<", class_name, " ", info, ">")); |
| 1923 | } |
| 1924 | |
| 1925 | // Fallback: build repr from task properties directly |
| 1926 | let state = zelf.base.fut_state.load().as_str().to_lowercase(); |
| 1927 | let name = zelf.task_name.read().as_ref().and_then(|n| n.str(vm).ok()); |
| 1928 | let coro_repr = zelf.task_coro.read().as_ref().and_then(|c| c.repr(vm).ok()); |
| 1929 | let name = name.as_ref().map_or("?".as_ref(), |s| s.as_wtf8()); |
| 1930 | let coro_repr = coro_repr.as_ref().map_or("?".as_ref(), |s| s.as_wtf8()); |
| 1931 | Ok(wtf8_concat!( |
| 1932 | "<", class_name, " ", state, " name='", name, "' coro=", coro_repr, ">" |
| 1933 | )) |
| 1934 | } else { |
| 1935 | Ok(Wtf8Buf::from(format!("<{class_name} ...>"))) |
| 1936 | } |
| 1937 | } |
| 1938 | } |
| 1939 | |
| 1940 | impl Iterable for PyTask { |
nothing calls this directly
no test coverage detected