@@ -3,6 +3,7 @@ import sys
33from _thread import _excepthook , _ExceptHookArgs , get_native_id as get_native_id
44from _typeshed import ProfileFunction , TraceFunction
55from collections .abc import Callable , Iterable , Mapping
6+ from contextvars import ContextVar
67from types import TracebackType
78from typing import Any , TypeVar , final
89from typing_extensions import deprecated
@@ -76,16 +77,30 @@ class Thread:
7677 @property
7778 def ident (self ) -> int | None : ...
7879 daemon : bool
79- def __init__ (
80- self ,
81- group : None = None ,
82- target : Callable [..., object ] | None = None ,
83- name : str | None = None ,
84- args : Iterable [Any ] = (),
85- kwargs : Mapping [str , Any ] | None = None ,
86- * ,
87- daemon : bool | None = None ,
88- ) -> None : ...
80+ if sys .version_info >= (3 , 14 ):
81+ def __init__ (
82+ self ,
83+ group : None = None ,
84+ target : Callable [..., object ] | None = None ,
85+ name : str | None = None ,
86+ args : Iterable [Any ] = (),
87+ kwargs : Mapping [str , Any ] | None = None ,
88+ * ,
89+ daemon : bool | None = None ,
90+ context : ContextVar [Any ] | None = None ,
91+ ) -> None : ...
92+ else :
93+ def __init__ (
94+ self ,
95+ group : None = None ,
96+ target : Callable [..., object ] | None = None ,
97+ name : str | None = None ,
98+ args : Iterable [Any ] = (),
99+ kwargs : Mapping [str , Any ] | None = None ,
100+ * ,
101+ daemon : bool | None = None ,
102+ ) -> None : ...
103+
89104 def start (self ) -> None : ...
90105 def run (self ) -> None : ...
91106 def join (self , timeout : float | None = None ) -> None : ...
@@ -116,6 +131,9 @@ class _RLock:
116131 __enter__ = acquire
117132 def __exit__ (self , t : type [BaseException ] | None , v : BaseException | None , tb : TracebackType | None ) -> None : ...
118133
134+ if sys .version_info >= (3 , 14 ):
135+ def locked (self ) -> bool : ...
136+
119137RLock = _thread .RLock # Actually a function at runtime.
120138
121139class Condition :
0 commit comments