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)
This commit is contained in:
nobuggy
2016-10-29 16:58:09 +02:00
committed by Guido van Rossum
parent fed966cf7f
commit fa1eeb024e
2 changed files with 3 additions and 3 deletions

View File

@@ -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):

View File

@@ -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: ...