From ba9116c684ab185d08555fa51f41621822bd2e19 Mon Sep 17 00:00:00 2001 From: Stephen Morton Date: Sat, 23 Nov 2024 03:16:45 -0800 Subject: [PATCH] mark `sys.UnraisableHookArgs` as type_check_only (#13077) mark sys.UnraisableHookArgs as type_check_only --- stdlib/@tests/stubtest_allowlists/common.txt | 1 - stdlib/sys/__init__.pyi | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/@tests/stubtest_allowlists/common.txt b/stdlib/@tests/stubtest_allowlists/common.txt index 6a6fb135451f..b54fc4056281 100644 --- a/stdlib/@tests/stubtest_allowlists/common.txt +++ b/stdlib/@tests/stubtest_allowlists/common.txt @@ -71,7 +71,6 @@ socketserver.BaseServer.fileno # implemented in derived classes socketserver.BaseServer.get_request # implemented in derived classes socketserver.BaseServer.server_bind # implemented in derived classes ssl.Purpose.__new__ # the multiple inheritance confuses mypy -sys.UnraisableHookArgs # Not exported from sys tarfile.TarFile.errors # errors is initialized for some reason as None even though it really only accepts str tkinter.simpledialog.[A-Z_]+ tkinter.simpledialog.TclVersion diff --git a/stdlib/sys/__init__.pyi b/stdlib/sys/__init__.pyi index eab95b6aa6b9..505e38fa5751 100644 --- a/stdlib/sys/__init__.pyi +++ b/stdlib/sys/__init__.pyi @@ -415,6 +415,7 @@ if sys.version_info < (3, 9): def callstats() -> tuple[int, int, int, int, int, int, int, int, int, int, int] | None: ... # Doesn't exist at runtime, but exported in the stubs so pytest etc. can annotate their code more easily. +@type_check_only class UnraisableHookArgs(Protocol): exc_type: type[BaseException] exc_value: BaseException | None