From 50a661afedefd9a489305acedf908f1f32fa220c Mon Sep 17 00:00:00 2001 From: Rebecca Chen Date: Tue, 9 Apr 2019 11:02:04 -0700 Subject: [PATCH] Complete the stub for _thread.pyi. (#2900) Definitions based on https://docs.python.org/3/library/_thread.html. --- stdlib/3/_thread.pyi | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/stdlib/3/_thread.pyi b/stdlib/3/_thread.pyi index a8e38a91a..43547d617 100644 --- a/stdlib/3/_thread.pyi +++ b/stdlib/3/_thread.pyi @@ -1,15 +1,31 @@ # Stubs for _thread -# NOTE: These are incomplete! +from types import TracebackType +from typing import Any, Callable, Dict, NoReturn, Optional, Tuple, Type -from typing import Any +error = RuntimeError def _count() -> int: ... + _dangling = ... # type: Any class LockType: - def acquire(self) -> None: ... + def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool: ... def release(self) -> None: ... + def locked(self) -> bool: ... + def __enter__(self) -> bool: ... + def __exit__( + self, + type: Optional[Type[BaseException]], + value: Optional[BaseException], + traceback: Optional[TracebackType], + ) -> None: ... +def start_new_thread(function: Callable[..., Any], args: Tuple[Any, ...], kwargs: Dict[str, Any] = ...) -> int: ... +def interrupt_main() -> None: ... +def exit() -> NoReturn: ... def allocate_lock() -> LockType: ... def get_ident() -> int: ... +def stack_size(size: int = ...) -> int: ... + +TIMEOUT_MAX: int