From da39380560de588b5e16efc334f62ecc6dd9af40 Mon Sep 17 00:00:00 2001 From: James Clark Date: Mon, 28 Sep 2026 13:58:09 +0100 Subject: perf python: Fix arm-cs-trace-disasm type error The perf sample dso_bid getter returns a string or None, matching its Optional[str] annotation. Attempting to decode it as bytes causes mypy to report union-attr errors, even though this was behind a conditional that checked for bytes type. Use the string directly, retaining the fallback for an unknown build ID. This fixes the following build error: python/arm-cs-trace-disasm.py:266: error: Item "None" of "str | None" has no attribute "decode" [union-attr] Fixes: 279b402e5143214c ("perf python: Port arm-cs-trace-disasm to perf module") Reviewed-by: Leo Yan Reviewed-by: Ian Rogers Assisted-by: Codex:GPT-6-Astra Signed-off-by: James Clark Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/python/arm-cs-trace-disasm.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'tools/perf/python') diff --git a/tools/perf/python/arm-cs-trace-disasm.py b/tools/perf/python/arm-cs-trace-disasm.py index cf126ac79c18..1812ccaf4b20 100755 --- a/tools/perf/python/arm-cs-trace-disasm.py +++ b/tools/perf/python/arm-cs-trace-disasm.py @@ -263,9 +263,7 @@ class TraceDisasm: dso = getattr(sample, 'dso_long_name', None) or sample.dso or '[unknown]' symbol = sample.symbol or '[unknown]' - dso_bid = (sample.dso_bid.decode('utf-8') - if isinstance(sample.dso_bid, bytes) - else str(sample.dso_bid or '[unknown]')) + dso_bid = sample.dso_bid or '[unknown]' dso_start = sample.map_start dso_end = sample.map_end map_pgoff = sample.map_pgoff or 0 -- cgit v1.2.3