]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.15] gh-149430: Fix edge-cases in `profiling.sampling` outputs (GH-149431) (#149602)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sat, 9 May 2026 13:33:05 +0000 (15:33 +0200)
committerGitHub <noreply@github.com>
Sat, 9 May 2026 13:33:05 +0000 (13:33 +0000)
commitdc8c32e59d1ae4163b04b015f48dd54a6d6a11a2
treea124a892ee531ee9e2838d3dd63710e100f39e55
parent915b6c1572285f2bd469be177fe523eca52951f1
[3.15] gh-149430: Fix edge-cases in `profiling.sampling` outputs (GH-149431) (#149602)

gh-149430: Fix edge-cases in `profiling.sampling` outputs (GH-149431)

The line highlights on the heatmap are driven by the URL hash and the
`:target` selector. When clicking a caller/callee link for the line that
was already selected, the hash doesn't change, so the browser keeps the
existing target state and doesn't restart the animation. Due to this the
highlight only works the first time.

With this fix, line navigation goes through JavaScript. If the target
URL already points to the current location, the highlight is replayed by
clearing the animation, forcing style recalculation, and restoring it.

The `baseline_self` variable isn't initialized for structural elided
roots. This variable is accessed later unconditionally and leads to a
crash.

The child process ends up being invoked with `--diff_flamegraph` instead
of the correct argument.
(cherry picked from commit 9587726a3ebbcdb780e3f15c9e016e3a28c646e3)

Co-authored-by: László Kiss Kollár <kiss.kollar.laszlo@gmail.com>
Lib/profiling/sampling/_heatmap_assets/heatmap.js
Lib/profiling/sampling/cli.py
Lib/profiling/sampling/stack_collector.py
Lib/test/test_profiling/test_sampling_profiler/test_children.py
Lib/test/test_profiling/test_sampling_profiler/test_collectors.py