diff options
| author | Lalit Maganti <lalitmaganti@gmail.com> | 2026-10-18 07:53:45 +0100 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2026-10-27 17:40:37 -0300 |
| commit | aa0fec5853eea1eca4f0bd9fd26e0a9d25e1c109 (patch) | |
| tree | 7d6bd5c1d53cd02a529b2f5643e9957a6c11ef07 /scripts/basic/split-include.c | |
| parent | 022b0ac5d3e87f87cb7ba42d04d0bc3ddfdd6be4 (diff) | |
| download | linux-aa0fec5853eea1eca4f0bd9fd26e0a9d25e1c109.tar.gz linux-aa0fec5853eea1eca4f0bd9fd26e0a9d25e1c109.zip | |
perf pmu-events: Fix jevents.py type annotations for mypy 2.x
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: b3e9c396d0acab27 ("perf build: Make mypy build test opt-out (NO_MYPY=1)")
Signed-off-by: Lalit Maganti <lalitmaganti@gmail.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: James Clark <james.clark@linaro.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Assisted-by: LLM
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'scripts/basic/split-include.c')
0 files changed, 0 insertions, 0 deletions
