Skip to content

Commit e2a4092

Browse files
authored
asyncore: various fixes (#3820)
1 parent af09df9 commit e2a4092

File tree

2 files changed

+15
-29
lines changed

2 files changed

+15
-29
lines changed

stdlib/2and3/asyncore.pyi

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ class ExitNow(Exception): ...
2323
def read(obj: Any) -> None: ...
2424
def write(obj: Any) -> None: ...
2525
def readwrite(obj: Any, flags: int) -> None: ...
26-
def poll(timeout: float = ..., map: _maptype = ...) -> None: ...
27-
def poll2(timeout: float = ..., map: _maptype = ...) -> None: ...
26+
def poll(timeout: float = ..., map: Optional[_maptype] = ...) -> None: ...
27+
def poll2(timeout: float = ..., map: Optional[_maptype] = ...) -> None: ...
2828

2929
poll3 = poll2
3030

31-
def loop(timeout: float = ..., use_poll: bool = ..., map: _maptype = ..., count: Optional[int] = ...) -> None: ...
31+
def loop(timeout: float = ..., use_poll: bool = ..., map: Optional[_maptype] = ..., count: Optional[int] = ...) -> None: ...
3232

3333

3434
# Not really subclass of socket.socket; it's only delegation.
@@ -43,16 +43,16 @@ class dispatcher:
4343
ignore_log_types: frozenset[str]
4444
socket: Optional[SocketType]
4545

46-
def __init__(self, sock: Optional[SocketType] = ..., map: _maptype = ...) -> None: ...
47-
def add_channel(self, map: _maptype = ...) -> None: ...
48-
def del_channel(self, map: _maptype = ...) -> None: ...
49-
def create_socket(self, family: int, type: int) -> None: ...
50-
def set_socket(self, sock: SocketType, map: _maptype = ...) -> None: ...
46+
def __init__(self, sock: Optional[SocketType] = ..., map: Optional[_maptype] = ...) -> None: ...
47+
def add_channel(self, map: Optional[_maptype] = ...) -> None: ...
48+
def del_channel(self, map: Optional[_maptype] = ...) -> None: ...
49+
def create_socket(self, family: int = ..., type: int = ...) -> None: ...
50+
def set_socket(self, sock: SocketType, map: Optional[_maptype] = ...) -> None: ...
5151
def set_reuse_addr(self) -> None: ...
5252
def readable(self) -> bool: ...
5353
def writable(self) -> bool: ...
54-
def listen(self, backlog: int) -> None: ...
55-
def bind(self, address: Union[Tuple[Any, ...], str]) -> None: ...
54+
def listen(self, num: int) -> None: ...
55+
def bind(self, addr: Union[Tuple[Any, ...], str]) -> None: ...
5656
def connect(self, address: Union[Tuple[Any, ...], str]) -> None: ...
5757
def accept(self) -> Optional[Tuple[SocketType, Any]]: ...
5858
def send(self, data: bytes) -> int: ...
@@ -87,7 +87,7 @@ class dispatcher:
8787
def getsockname(self) -> Any: ...
8888

8989
@overload
90-
def getsockopt(self, level: int, optname: int) -> int: ...
90+
def getsockopt(self, level: int, optname: int, buflen: None = ...) -> int: ...
9191
@overload
9292
def getsockopt(self, level: int, optname: int, buflen: int) -> bytes: ...
9393

@@ -112,14 +112,14 @@ class dispatcher:
112112
def shutdown(self, how: int) -> None: ...
113113

114114
class dispatcher_with_send(dispatcher):
115-
def __init__(self, sock: SocketType = ..., map: _maptype = ...) -> None: ...
115+
def __init__(self, sock: SocketType = ..., map: Optional[_maptype] = ...) -> None: ...
116116
def initiate_send(self) -> None: ...
117117
def handle_write(self) -> None: ...
118118
# incompatible signature:
119119
# def send(self, data: bytes) -> Optional[int]: ...
120120

121121
def compact_traceback() -> Tuple[Tuple[str, str, str], type, type, str]: ...
122-
def close_all(map: _maptype = ..., ignore_all: bool = ...) -> None: ...
122+
def close_all(map: Optional[_maptype] = ..., ignore_all: bool = ...) -> None: ...
123123

124124
# if os.name == 'posix':
125125
# import fcntl
@@ -131,7 +131,7 @@ class file_wrapper:
131131
def send(self, data: bytes, flags: int = ...) -> int: ...
132132

133133
@overload
134-
def getsockopt(self, level: int, optname: int) -> int: ...
134+
def getsockopt(self, level: int, optname: int, buflen: None = ...) -> int: ...
135135
@overload
136136
def getsockopt(self, level: int, optname: int, buflen: int) -> bytes: ...
137137

@@ -142,5 +142,5 @@ class file_wrapper:
142142
def fileno(self) -> int: ...
143143

144144
class file_dispatcher(dispatcher):
145-
def __init__(self, fd: FileDescriptorLike, map: _maptype = ...) -> None: ...
145+
def __init__(self, fd: FileDescriptorLike, map: Optional[_maptype] = ...) -> None: ...
146146
def set_file(self, fd: int) -> None: ...

tests/stubtest_whitelists/py3_common.txt

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -68,20 +68,6 @@ asyncio.unix_events._UnixSelectorEventLoop.create_unix_server
6868
asyncio.windows_events
6969
asyncio.windows_utils
7070
asyncio.wrap_future
71-
asyncore.close_all
72-
asyncore.dispatcher.__init__
73-
asyncore.dispatcher.add_channel
74-
asyncore.dispatcher.bind
75-
asyncore.dispatcher.create_socket
76-
asyncore.dispatcher.del_channel
77-
asyncore.dispatcher.listen
78-
asyncore.dispatcher.set_socket
79-
asyncore.dispatcher_with_send.__init__
80-
asyncore.file_dispatcher.__init__
81-
asyncore.file_wrapper.getsockopt
82-
asyncore.loop
83-
asyncore.poll
84-
asyncore.poll2
8571
base64.b32decode
8672
base64.b64decode
8773
base64.b64encode

0 commit comments

Comments
 (0)