]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-149430: Fix edge-cases in `profiling.sampling` outputs (#149431)
authorLászló Kiss Kollár <kiss.kollar.laszlo@gmail.com>
Sat, 9 May 2026 13:05:46 +0000 (14:05 +0100)
committerGitHub <noreply@github.com>
Sat, 9 May 2026 13:05:46 +0000 (14:05 +0100)
commit9587726a3ebbcdb780e3f15c9e016e3a28c646e3
tree116614cbd9a178fcd28c0542d61e26bba371a984
parent46a2c11eaa8cbef6f73dd7050029bd8ff13026fc
gh-149430: Fix edge-cases in `profiling.sampling` outputs (#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.
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