From d27e90bb8a2d681862309eb8cfbd8ada64bbce97 Mon Sep 17 00:00:00 2001 From: MarcZX10 <67475268+MarcZX10@users.noreply.github.com> Date: Wed, 28 Oct 2026 03:13:51 +0000 Subject: [PATCH] fix(tools): sort trace presents by timestamp only Trace.presents holds (ts, args.present) pairs and was sorted as whole tuples. Two present events with the same timestamp, one with a present number and one without, made the sort compare None with an int and raised an uncaught TypeError, so trace_digest exited with a traceback instead of a digest. The sort now keys on the timestamp; it is stable, so tied events keep the order of the trace. --- tools/trace_digest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/trace_digest.py b/tools/trace_digest.py index 971d50e052..88d63bbca6 100644 --- a/tools/trace_digest.py +++ b/tools/trace_digest.py @@ -98,7 +98,7 @@ class Trace: elif phase == "C": tid = _event_tid(event, index) self.folded[tid] += sum(_event_value(value, "args value", index) for value in _event_args(event, index).values()) - self.presents.sort() + self.presents.sort(key=lambda present: present[0]) for slices in self.slices.values(): slices.sort(key=lambda entry: (entry[0], -entry[1])) stack = []