From fd3228a2e2242ff052c090ec3cd0c8b150cb8fe1 Mon Sep 17 00:00:00 2001 From: Stephen Morton Date: Mon, 18 Dec 2023 05:13:08 -0800 Subject: [PATCH] threading.ThreadError and threading.local are aliases from _thread (#11167) --- stdlib/_thread.pyi | 5 +++++ stdlib/threading.pyi | 9 +++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/stdlib/_thread.pyi b/stdlib/_thread.pyi index dba8664fb..8bd0b1796 100644 --- a/stdlib/_thread.pyi +++ b/stdlib/_thread.pyi @@ -46,3 +46,8 @@ if sys.version_info >= (3, 8): if sys.version_info >= (3, 12): def daemon_threads_allowed() -> bool: ... + +class _local: + def __getattribute__(self, __name: str) -> Any: ... + def __setattr__(self, __name: str, __value: Any) -> None: ... + def __delattr__(self, __name: str) -> None: ... diff --git a/stdlib/threading.pyi b/stdlib/threading.pyi index badd09cae..bcd73823c 100644 --- a/stdlib/threading.pyi +++ b/stdlib/threading.pyi @@ -1,3 +1,4 @@ +import _thread import sys from _typeshed import ProfileFunction, TraceFunction from collections.abc import Callable, Iterable, Mapping @@ -68,12 +69,8 @@ def stack_size(size: int = ...) -> int: ... TIMEOUT_MAX: float -class ThreadError(Exception): ... - -class local: - def __getattribute__(self, __name: str) -> Any: ... - def __setattr__(self, __name: str, __value: Any) -> None: ... - def __delattr__(self, __name: str) -> None: ... +ThreadError = _thread.error +local = _thread._local class Thread: name: str