[PATCH] perf python: Fix arm-cs-trace-disasm type error

From: James Clark

Date: Mon Sep 28 2026 - 09:14:51 EST


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: 279b402e5143 ("perf python: Port arm-cs-trace-disasm to perf module")
Assisted-by: Codex:GPT-6-Astra
Signed-off-by: James Clark <james.clark@xxxxxxxxxx>
---
tools/perf/python/arm-cs-trace-disasm.py | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

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

---
base-commit: 0ae6fc78c5ce0dfd18d8712a50f0fd4602eff103
change-id: 20260928-james-perf-mypy-cs-disasm-ed5ab0b60a8a

Best regards,
--
James Clark <james.clark@xxxxxxxxxx>