Re: [PATCH] perf python: Fix arm-cs-trace-disasm type error
From: James Clark
Date: Mon Sep 28 2026 - 09:55:26 EST
On 28/09/2026 14:46, Leo Yan wrote:
On Mon, Sep 28, 2026 at 01:58:09PM +0100, James Clark wrote:
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>
Thanks for the fix:
Reviewed-by: Leo Yan <leo.yan@xxxxxxx>
Just curious, have you run this script and compare the result with old
one? Seems to me, the build pass is insufficient, we should run a small
test to ensure the result to keep same.
Thanks,
Leo
Yep the test still passes. I assume the "if isinstance(sample.dso_bid, bytes)" part was just dead code.