Re: [PATCH] perf build: Replace the deprecated FileType with a helper

From: Namhyung Kim

Date: Wed Nov 25 2026 - 14:24:01 EST



On Wed, Nov 25, 2026 at 05:33:15PM +0000, TAKANO Mitsuhiro wrote:
> pylint-tests and pylint-pmu-events hang off `all`, so with a pylint that
> reports W4904 the build fails on a tree nobody has changed. Measured on
> 7.4-rc4 with Python 3.14.9 and pylint 4.0.5, both targets exit 2 and
> pylint reports:
>
> - W4904 deprecated-class, argparse.FileType: pmu-events/jevents.py:1494
> and :1496, tests/shell/lib/perf_json_output_lint.py:23
>
> FileType is deprecated in the class's own terms - the docstring in 3.14
> reads "Deprecated factory for creating file object types" - so the two
> jevents call sites and the one in the JSON output linter are replaced by
> a helper that opens the file, or hands back stdout or stdin for '-',
> which is what FileType did. The reader names its encoding, as the rest
> of the Python in perf does.
>
> Verification: pylint-tests and pylint-pmu-events exit 2 and 2 before this
> change and 0 and 0 after it. The generated pmu-events tables are byte
> identical either side of the change, checked by running jevents.py for
> arm64 and x86 over the same input tree and comparing pmu-events.c and
> pmu-events-string.c.
>
> Written with Hermes Agent, an LLM assistant; the author reviewed it and
> ran the build and the generator as described.
>

I think we have a pending patch already.

https://lore.kernel.org/r/20261115003507.1872482-1-lalitmaganti@xxxxxxxxx

Thanks,
Namhyung