From f46ed2a07d380bb15a0b6ed4a49b72c16e5a86d2 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Sat, 12 Jul 2025 18:54:26 +0300 Subject: [PATCH] gh-136549: Fix signature of threading.excepthook() (GH-136559) (cherry picked from commit be2c3d284ecce67474a260b8c37e2f1e0628a9cf) Co-authored-by: Serhiy Storchaka --- Lib/test/test_inspect/test_inspect.py | 1 + .../next/Library/2025-07-11-23-04-39.gh-issue-136549.oAi8u4.rst | 1 + Modules/_threadmodule.c | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Library/2025-07-11-23-04-39.gh-issue-136549.oAi8u4.rst diff --git a/Lib/test/test_inspect/test_inspect.py b/Lib/test/test_inspect/test_inspect.py index 55942c2823c492..0a8926e00cf8b9 100644 --- a/Lib/test/test_inspect/test_inspect.py +++ b/Lib/test/test_inspect/test_inspect.py @@ -5916,6 +5916,7 @@ def test_sysconfig_module_has_signatures(self): def test_threading_module_has_signatures(self): import threading self._test_module_has_signatures(threading) + self.assertIsNotNone(inspect.signature(threading.__excepthook__)) def test_thread_module_has_signatures(self): import _thread diff --git a/Misc/NEWS.d/next/Library/2025-07-11-23-04-39.gh-issue-136549.oAi8u4.rst b/Misc/NEWS.d/next/Library/2025-07-11-23-04-39.gh-issue-136549.oAi8u4.rst new file mode 100644 index 00000000000000..f3050ad5d5aa10 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2025-07-11-23-04-39.gh-issue-136549.oAi8u4.rst @@ -0,0 +1 @@ +Fix signature of :func:`threading.excepthook`. diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c index 73dfb943845095..121b0f803715af 100644 --- a/Modules/_threadmodule.c +++ b/Modules/_threadmodule.c @@ -2317,7 +2317,7 @@ thread_excepthook(PyObject *module, PyObject *args) } PyDoc_STRVAR(excepthook_doc, -"_excepthook($module, (exc_type, exc_value, exc_traceback, thread), /)\n\ +"_excepthook($module, args, /)\n\ --\n\ \n\ Handle uncaught Thread.run() exception.");