Linux Perf Users
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Arnaldo Carvalho de Melo" <acme@kernel.org>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH 1/1] perf tools: Bump the minimum Python version to 3.9
Date: Fri, 25 Sep 2026 23:08:12 +0000	[thread overview]
Message-ID: <20260925230813.6F6F61F000FF@smtp.kernel.org> (raw)
In-Reply-To: <arb9OMEQ8HCcw-9O@x2>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] perf: incomplete python 3.9 version check leads to build crash
--

commit 7a016e98c4330410787d9ac22be5c76fe463b5ce
Author: Arnaldo Carvalho de Melo <acme@kernel.org>

perf tools: Bump the minimum Python version to 3.9

This commit bumps the minimum Python version required by the perf build
from 3.6 to 3.9. It replaces the custom removesuffix() implementation
with the built-in str.removesuffix() and updates the version check in
Makefile.config.

> diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> index 0ba307e78fe1f..549a809a88ca2 100644
> --- a/tools/perf/Makefile.config
> +++ b/tools/perf/Makefile.config
> @@ -876,10 +876,12 @@ ifneq ($(NO_JEVENTS),1)
>    ifndef PYTHON
>      $(error ERROR: No python interpreter needed for jevents generation. Install python or build with NO_JEVENTS=1.)
>    else
> -    # jevents.py uses f-strings present in Python 3.6 released in Dec. 2016.
> -    JEVENTS_PYTHON_GOOD := $(shell $(PYTHON) -c 'import sys;print("1" if(sys.version_info.major >= 3 and sys.version_info.minor >= 6) else "0")' 2> /dev/null)
> +    # Minimum Python version, the same one the kernel requires, see
> +    # Documentation/process/changes.rst: jevents.py needs PEP 585 generics,
> +    # list[...] and friends, that are subscriptable from Python 3.9.
> +    JEVENTS_PYTHON_GOOD := $(shell $(PYTHON) -c 'import sys;print("1" if sys.version_info >= (3, 9) else "0")' 2> /dev/null)
>      ifneq ($(JEVENTS_PYTHON_GOOD), 1)
> -      $(error ERROR: Python interpreter needed for jevents generation too old (older than 3.6). Install a newer python or build with NO_JEVENTS=1.)
> +      $(error ERROR: Python interpreter needed for jevents generation too old (older than 3.9). Install a newer python or build with NO_JEVENTS=1.)

[Severity: Low]
If a user with an older Python version follows the suggestion to build
with NO_JEVENTS=1, won't the build crash later on?

Because this version check is inside the ifneq ($(NO_JEVENTS),1) block,
setting NO_JEVENTS=1 bypasses it. However, tools/perf/util/setup.py also
requires Python 3.9 for the PEP 585 list[str] generic in functions like
clang_has_option():

tools/perf/util/setup.py:clang_has_option() {
    def clang_has_option(cc: str, cc_args: list[str], ...
}

When the build reaches setup.py to build the Python bindings (unless
NO_LIBPYTHON=1 is also specified), won't it fail with a cryptic TypeError
("'type' object is not subscriptable") instead of a clean Makefile error?

Should this Python 3.9 version requirement be enforced globally rather than
just for jevents generation, or should the suggestion to use NO_JEVENTS=1
be removed?

>      endif
>    endif
>  endif

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/arb9OMEQ8HCcw-9O@x2?part=1

  reply	other threads:[~2026-09-25 23:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-25 23:01 [PATCH 1/1] perf tools: Bump the minimum Python version to 3.9 Arnaldo Carvalho de Melo
2026-09-25 23:08 ` sashiko-bot [this message]
2026-09-25 23:37 ` Mauro Carvalho Chehab
2026-09-26  0:22 ` Ian Rogers
2026-09-26  7:51   ` Arnaldo Carvalho de Melo
2026-09-26 15:00     ` Ian Rogers
2026-09-26 19:30       ` Arnaldo Carvalho de Melo

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=20260925230813.6F6F61F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=acme@kernel.org \
    --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