From fa1eeb024ee955ff86bb6926002e5f1898fa819c Mon Sep 17 00:00:00 2001 From: nobuggy Date: Sat, 29 Oct 2016 16:58:09 +0200 Subject: [PATCH] Two minor glitches in stdlib asyncio.Event.wait() / asyncio.wait_for() (#636) * Event.wait() is a coroutine (https://docs.python.org/3/library/asyncio-sync.html#asyncio.Event) * asyncio.wait_for accepts None as timeout (https://docs.python.org/3/library/asyncio-task.html) --- stdlib/3.4/asyncio/locks.pyi | 2 +- stdlib/3.4/asyncio/tasks.pyi | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/stdlib/3.4/asyncio/locks.pyi b/stdlib/3.4/asyncio/locks.pyi index 4d665ae43..2467ffec0 100644 --- a/stdlib/3.4/asyncio/locks.pyi +++ b/stdlib/3.4/asyncio/locks.pyi @@ -32,7 +32,7 @@ class Event: def is_set(self) -> bool: ... def set(self) -> None: ... def clear(self) -> None: ... - + @coroutine def wait(self) -> bool: ... class Condition(_ContextManagerMixin): diff --git a/stdlib/3.4/asyncio/tasks.pyi b/stdlib/3.4/asyncio/tasks.pyi index e5b101c6e..70a187d4a 100644 --- a/stdlib/3.4/asyncio/tasks.pyi +++ b/stdlib/3.4/asyncio/tasks.pyi @@ -1,4 +1,4 @@ -from typing import Any, TypeVar, Set, Dict, List, TextIO, Union, Tuple, Generic, Callable, Generator, Iterable, Awaitable, overload, Sequence, Iterator +from typing import Any, TypeVar, Set, Dict, List, TextIO, Union, Tuple, Generic, Callable, Generator, Iterable, Awaitable, overload, Sequence, Iterator, Optional __all__ = ... # type: str @@ -17,7 +17,7 @@ def shield(arg: Union[Future[_T], Generator[Any, None, _T]], *, loop: AbstractEv def sleep(delay: float, result: _T = ..., loop: AbstractEventLoop = ...) -> Future[_T]: ... def wait(fs: List[Task[_T]], *, loop: AbstractEventLoop = ..., timeout: float = ..., return_when: str = ...) -> Future[Tuple[Set[Future[_T]], Set[Future[_T]]]]: ... -def wait_for(fut: Union[Future[_T], Generator[Any, None, _T]], timeout: float, *, loop: AbstractEventLoop = ...) -> Future[_T]: ... +def wait_for(fut: Union[Future[_T], Generator[Any, None, _T]], timeout: Optional[float], *, loop: AbstractEventLoop = ...) -> Future[_T]: ... class _GatheringFuture(Future[_T], Generic[_T]): def __init__(self, children: Sequence[Union[Future[_T], Generator[Any, None, _T]]], *, loop: AbstractEventLoop = ...) -> None: ...