Re: [PATCH] perf python: Fix arm-cs-trace-disasm type error
From: Leo Yan
Date: Mon Sep 28 2026 - 09:51:50 EST
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