diff --git a/stdlib/@tests/test_cases/check_concurrent_futures.py b/stdlib/@tests/test_cases/check_concurrent_futures.py index ba6ca0845719..82cf03fb5c49 100644 --- a/stdlib/@tests/test_cases/check_concurrent_futures.py +++ b/stdlib/@tests/test_cases/check_concurrent_futures.py @@ -51,7 +51,7 @@ def check_interpreter_pool_executor() -> None: worker_context = context[0]() assert_type(worker_context, concurrent.futures.interpreter.WorkerContext) resolve_task = context[1] - # Function should enfore that the arguments are correct. + # Function should enforce that the arguments are correct. res = resolve_task(_initializer, 1) assert_type(res, tuple[bytes, Literal["function"]]) # When the function is a script, the arguments should be a string. diff --git a/stdlib/concurrent/futures/thread.pyi b/stdlib/concurrent/futures/thread.pyi index 22df0dca5a3f..50a6a9c6f43e 100644 --- a/stdlib/concurrent/futures/thread.pyi +++ b/stdlib/concurrent/futures/thread.pyi @@ -91,8 +91,12 @@ class ThreadPoolExecutor(Executor): _shutdown: bool _shutdown_lock: Lock _thread_name_prefix: str | None - _initializer: Callable[..., None] | None - _initargs: tuple[Any, ...] + if sys.version_info >= (3, 14): + _create_worker_context: Callable[[], WorkerContext] + _resolve_work_item_task: _ResolveTaskFunc + else: + _initializer: Callable[..., None] | None + _initargs: tuple[Any, ...] _work_queue: queue.SimpleQueue[_WorkItem[Any]] if sys.version_info >= (3, 14): @@ -100,12 +104,12 @@ class ThreadPoolExecutor(Executor): @classmethod def prepare_context( cls, initializer: Callable[[], object], initargs: tuple[()] - ) -> tuple[Callable[[], Self], _ResolveTaskFunc]: ... + ) -> tuple[Callable[[], WorkerContext], _ResolveTaskFunc]: ... @overload @classmethod def prepare_context( cls, initializer: Callable[[Unpack[_Ts]], object], initargs: tuple[Unpack[_Ts]] - ) -> tuple[Callable[[], Self], _ResolveTaskFunc]: ... + ) -> tuple[Callable[[], WorkerContext], _ResolveTaskFunc]: ... @overload def __init__(