Skip to content

Commit 503cbb9

Browse files
aaugustinsrittau
authored andcommitted
Fix signature of asyncio.create_server. (#2763)
* host may be None to bind to all interfaces. * If sock is given, host and port shouldn't be specified.
1 parent b0eb6c2 commit 503cbb9

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

stdlib/3/asyncio/events.pyi

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,20 @@ class AbstractEventLoop(metaclass=ABCMeta):
108108
def create_connection(self, protocol_factory: _ProtocolFactory, host: str = ..., port: int = ..., *,
109109
ssl: _SSLContext = ..., family: int = ..., proto: int = ..., flags: int = ..., sock: Optional[socket] = ...,
110110
local_addr: str = ..., server_hostname: str = ...) -> Generator[Any, None, _TransProtPair]: ...
111+
@overload
112+
@abstractmethod
113+
@coroutine
114+
def create_server(self, protocol_factory: _ProtocolFactory, host: Optional[Union[str, Sequence[str]]] = ..., port: int = ..., *,
115+
family: int = ..., flags: int = ...,
116+
sock: None = ..., backlog: int = ..., ssl: _SSLContext = ...,
117+
reuse_address: Optional[bool] = ...,
118+
reuse_port: Optional[bool] = ...) -> Generator[Any, None, AbstractServer]: ...
119+
@overload
111120
@abstractmethod
112121
@coroutine
113-
def create_server(self, protocol_factory: _ProtocolFactory, host: Union[str, Sequence[str]] = ..., port: int = ..., *,
122+
def create_server(self, protocol_factory: _ProtocolFactory, host: None = ..., port: None = ..., *,
114123
family: int = ..., flags: int = ...,
115-
sock: Optional[socket] = ..., backlog: int = ..., ssl: _SSLContext = ...,
124+
sock: socket = ..., backlog: int = ..., ssl: _SSLContext = ...,
116125
reuse_address: Optional[bool] = ...,
117126
reuse_port: Optional[bool] = ...) -> Generator[Any, None, AbstractServer]: ...
118127
@abstractmethod

0 commit comments

Comments
 (0)