mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] perf python: Fix arm-cs-trace-disasm type error
@ 2026-09-28 12:58 James Clark
  2026-09-28 13:46 ` Leo Yan
  0 siblings, 1 reply; 5+ messages in thread
From: James Clark @ 2026-09-28 12:58 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Namhyung Kim, Ian Rogers, Leo Yan
  Cc: linux-perf-users, linux-kernel, James Clark

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@linaro.org>
---
 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@linaro.org>


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-09-28 16:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-28 12:58 [PATCH] perf python: Fix arm-cs-trace-disasm type error James Clark
2026-09-28 13:46 ` Leo Yan
2026-09-28 13:52   ` James Clark
2026-09-28 15:11     ` Ian Rogers
2026-09-28 16:29     ` Arnaldo Carvalho de Melo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®