From 94e926fa6ff09b0c133af71f7baf9abda16ff81c Mon Sep 17 00:00:00 2001 From: Guo Ci Date: Thu, 13 Nov 2025 12:53:24 -0500 Subject: [PATCH 1/3] Add `threading.__excepthook__` --- stdlib/threading.pyi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stdlib/threading.pyi b/stdlib/threading.pyi index 28fa5267a997..fc3be74ed3a1 100644 --- a/stdlib/threading.pyi +++ b/stdlib/threading.pyi @@ -170,6 +170,8 @@ class Event: def wait(self, timeout: float | None = None) -> bool: ... excepthook = _excepthook +if sys.version_info >= (3, 10): + __excepthook__ = _excepthook ExceptHookArgs = _ExceptHookArgs class Timer(Thread): From 3f97d38c6ce5d23a8d57f6c192e49fb017304328 Mon Sep 17 00:00:00 2001 From: Guo Ci Date: Fri, 14 Nov 2025 15:26:31 -0500 Subject: [PATCH 2/3] Update stdlib/threading.pyi Co-authored-by: Sebastian Rittau --- stdlib/threading.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/threading.pyi b/stdlib/threading.pyi index fc3be74ed3a1..b044fdcfaa8b 100644 --- a/stdlib/threading.pyi +++ b/stdlib/threading.pyi @@ -169,9 +169,9 @@ class Event: def clear(self) -> None: ... def wait(self, timeout: float | None = None) -> bool: ... -excepthook = _excepthook +excepthook: Callable[[_ExceptHookArgs], object] if sys.version_info >= (3, 10): - __excepthook__ = _excepthook + __excepthook__: Callable[[_ExceptHookArgs], object] ExceptHookArgs = _ExceptHookArgs class Timer(Thread): From 359774f8f1df3c397ded5ac016bc65afd19f7e84 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 14 Nov 2025 20:31:12 +0000 Subject: [PATCH 3/3] [pre-commit.ci] auto fixes from pre-commit.com hooks --- stdlib/threading.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/threading.pyi b/stdlib/threading.pyi index b044fdcfaa8b..7b0f15bdfa2e 100644 --- a/stdlib/threading.pyi +++ b/stdlib/threading.pyi @@ -1,6 +1,6 @@ import _thread import sys -from _thread import _excepthook, _ExceptHookArgs, get_native_id as get_native_id +from _thread import _ExceptHookArgs, get_native_id as get_native_id from _typeshed import ProfileFunction, TraceFunction from collections.abc import Callable, Iterable, Mapping from contextvars import ContextVar