From: James Clark <james.clark@linaro.org>
To: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
Adrian Hunter <adrian.hunter@intel.com>,
Alice Rogers <alice.mei.rogers@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
James Clark <james.clark@linaro.org>
Subject: [PATCH 2/2] perf treport: Fix profile builder type narrowing in progress callback
Date: Tue, 06 Oct 2026 14:03:32 +0100 [thread overview]
Message-ID: <20261006-james-perf-timechart-mypy-v1-2-e2c7edf4dd31@linaro.org> (raw)
In-Reply-To: <20261006-james-perf-timechart-mypy-v1-0-e2c7edf4dd31@linaro.org>
Mypy does not retain the narrowing of an optional local variable inside
the nested progress callback, causing the perf build to fail with:
python/treport.py:649: error: Item "None" of "ProfileBuilder | None" has no attribute "cancelled" [union-attr]
Check the loading builder before assigning it to profile so the captured
variable is inferred as ProfileBuilder rather than
Optional[ProfileBuilder]. Keep the existing assertion and background
loading behavior.
Fixes: b379b70b7b7b ("perf treport: Show the profile while it loads")
Assisted-by: Codex:GPT-6.1-Sol
Signed-off-by: James Clark <james.clark@linaro.org>
---
tools/perf/python/treport.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/tools/perf/python/treport.py b/tools/perf/python/treport.py
index e02121475370..fb583786b17a 100755
--- a/tools/perf/python/treport.py
+++ b/tools/perf/python/treport.py
@@ -638,8 +638,9 @@ class ReportApp(App):
@work(thread=True, exclusive=True)
def load_profile(self) -> None:
"""Build the profile in a thread so the UI stays responsive."""
- profile = self.loading
- assert profile is not None
+ loading = self.loading
+ assert loading is not None
+ profile = loading
def progress() -> None:
try:
--
2.43.0
prev parent reply other threads:[~2026-10-06 13:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-06 13:03 [PATCH 0/2] perf timechart/treport: Fix mypy errors James Clark
2026-10-06 13:03 ` [PATCH 1/2] perf timechart: Fix task row type narrowing in goto_task() James Clark
2026-10-06 13:03 ` James Clark [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=20261006-james-perf-timechart-mypy-v1-2-e2c7edf4dd31@linaro.org \
--to=james.clark@linaro.org \
--cc=acme@kernel.org \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=alice.mei.rogers@gmail.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
/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
all inboxes | Powered by JetHome®