Linux Perf Users
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Lalit Maganti" <lalitmaganti@gmail.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH] perf pmu-events: Fix jevents.py type annotations for mypy 2.x
Date: Sun, 18 Oct 2026 06:55:30 +0000	[thread overview]
Message-ID: <sashiko-outbox-176000@kernel.org> (raw)
In-Reply-To: <20261018065345.918176-1-lalitmaganti@gmail.com>

> Since the build runs mypy whenever it is installed, the perf build fails
> with mypy 2.4 on 7 errors in jevents.py, e.g.:
> 
>   pmu-events/jevents.py:542: error: Item "None" of "str | None" has no
>   attribute "replace"  [union-attr]
>   pmu-events/jevents.py:563: error: Item "None" of "BigCString | None"
>   has no attribute "offsets"  [union-attr]
> 
> Both come from wrong annotations rather than from code that can see
> None:
>  - unit_to_pmu() is annotated as returning Optional[str] but always
>    returns a string, so JsonEvent.pmu is typed as optional where it is
>    used as a str.
>  - _bcs is set to None before the BigCString class is defined and only
>    assigned an instance after it, so mypy types it as BigCString | None.
> 
> Correct the return type and declare _bcs with its type instead of the
> None placeholder. The generated pmu-events.c and pmu-events-string.c
> are unchanged, and mypy 1.9 still passes.
> 
> Fixes: b3e9c396d0ac ("perf build: Make mypy build test opt-out (NO_MYPY=1)")
> Assisted-by: LLM
> Signed-off-by: Lalit Maganti <lalitmaganti@gmail.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261018065345.918176-1-lalitmaganti@gmail.com?part=1


      reply	other threads:[~2026-10-18  6:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-18  6:53 [PATCH] perf pmu-events: Fix jevents.py type annotations for mypy 2.x Lalit Maganti
2026-10-18  6:55 ` sashiko-bot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-176000@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=lalitmaganti@gmail.com \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox