[PATCH] rteval: Make thread excepthook portable and support chaining

John Kacur <[email protected]> Tue, 7 Jul 2026 14:18:12 -0400
Newsgroups org.kernel.vger.linux-rt-users
Message-ID <[email protected]>
Replace the direct use of threading.__excepthook__ with the original
threading.excepthook captured at module initialization. This enables
compatibility with Python versions 3.8 and 3.9 (where __excepthook__ is
not defined) and preserves any custom exception hooks registered by test
runners or parent programs.

Signed-off-by: Gabriele Monaco <[email protected]>
Signed-off-by: John Kacur <[email protected]>
---
 rteval/__init__.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/rteval/__init__.py b/rteval/__init__.py
index 2eadb2045e2b..6e49889a6d67 100644
--- a/rteval/__init__.py
+++ b/rteval/__init__.py
@@ -41,10 +41,11 @@ def sig_handler(signum, frame):
     else:
         raise RuntimeError(f"SIGNAL received! ({signum})")
 
+orig_excepthook = threading.excepthook
 def except_hook(args):
     global threaderr
 
-    threading.__excepthook__(args)
+    orig_excepthook(args)
     threaderr = True
     stopsig.set()
 
-- 
2.54.0