Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 2 additions & 11 deletions stdlib/asyncio/proactor_events.pyi
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
import sys
from collections.abc import Mapping
from socket import socket
from typing import Any, ClassVar, Protocol
from typing import Any, ClassVar
from typing_extensions import Literal

from . import base_events, constants, events, futures, streams, transports

__all__ = ("BaseProactorEventLoop",)

if sys.version_info >= (3, 8):
class _WarnCallbackProtocol(Protocol):
def __call__(
self, message: str, category: type[Warning] | None = ..., stacklevel: int = ..., source: Any | None = ...
) -> object: ...

class _ProactorBasePipeTransport(transports._FlowControlMixin, transports.BaseTransport):
def __init__(
self,
Expand All @@ -24,10 +18,7 @@ class _ProactorBasePipeTransport(transports._FlowControlMixin, transports.BaseTr
extra: Mapping[Any, Any] | None = None,
server: events.AbstractServer | None = None,
) -> None: ...
if sys.version_info >= (3, 8):
def __del__(self, _warn: _WarnCallbackProtocol = ...) -> None: ...
else:
def __del__(self) -> None: ...
def __del__(self) -> None: ...

class _ProactorReadPipeTransport(_ProactorBasePipeTransport, transports.ReadTransport):
if sys.version_info >= (3, 10):
Expand Down
9 changes: 1 addition & 8 deletions stdlib/asyncio/unix_events.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,6 @@ if sys.platform != "win32":
DefaultEventLoopPolicy = _UnixDefaultEventLoopPolicy

if sys.version_info >= (3, 8):
from typing import Protocol

class _Warn(Protocol):
def __call__(
self, message: str, category: type[Warning] | None = ..., stacklevel: int = ..., source: Any | None = ...
) -> object: ...

class MultiLoopChildWatcher(AbstractChildWatcher):
def is_active(self) -> bool: ...
def close(self) -> None: ...
Expand All @@ -109,7 +102,7 @@ if sys.platform != "win32":
def __exit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: types.TracebackType | None
) -> None: ...
def __del__(self, _warn: _Warn = ...) -> None: ...
def __del__(self) -> None: ...
def add_child_handler(self, pid: int, callback: Callable[..., object], *args: Any) -> None: ...
def remove_child_handler(self, pid: int) -> bool: ...
def attach_loop(self, loop: AbstractEventLoop | None) -> None: ...
Expand Down
12 changes: 2 additions & 10 deletions stdlib/asyncio/windows_utils.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,20 @@ import subprocess
import sys
from collections.abc import Callable
from types import TracebackType
from typing import Any, AnyStr, Protocol
from typing import Any, AnyStr
from typing_extensions import Literal, Self

if sys.platform == "win32":
__all__ = ("pipe", "Popen", "PIPE", "PipeHandle")

class _WarnFunction(Protocol):
def __call__(
self, message: str, category: type[Warning] = ..., stacklevel: int = ..., source: PipeHandle = ...
) -> object: ...
BUFSIZE: Literal[8192]
PIPE = subprocess.PIPE
STDOUT = subprocess.STDOUT
def pipe(*, duplex: bool = False, overlapped: tuple[bool, bool] = (True, True), bufsize: int = 8192) -> tuple[int, int]: ...

class PipeHandle:
def __init__(self, handle: int) -> None: ...
if sys.version_info >= (3, 8):
def __del__(self, _warn: _WarnFunction = ...) -> None: ...
else:
def __del__(self) -> None: ...

def __del__(self) -> None: ...
def __enter__(self) -> Self: ...
def __exit__(self, t: type[BaseException] | None, v: BaseException | None, tb: TracebackType | None) -> None: ...
@property
Expand Down
5 changes: 5 additions & 0 deletions tests/stubtest_allowlists/darwin.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,8 @@ curses.COLORS # Initialized after start_color
curses.COLOR_PAIRS # Initialized after start_color
curses.COLS # Initialized only after initscr call
curses.LINES # Initialized only after initscr call

# Takes a "_warn" parameter at runtime
# for technical reasons; no need to expose it in the stub.
asyncio.ThreadedChildWatcher.__del__
asyncio.unix_events.ThreadedChildWatcher.__del__
5 changes: 5 additions & 0 deletions tests/stubtest_allowlists/linux.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,8 @@ curses.COLORS # Initialized after start_color
curses.COLOR_PAIRS # Initialized after start_color
curses.COLS # Initialized only after initscr call
curses.LINES # Initialized only after initscr call

# Takes a "_warn" parameter at runtime
# for technical reasons; no need to expose it in the stub.
asyncio.ThreadedChildWatcher.__del__
asyncio.unix_events.ThreadedChildWatcher.__del__
4 changes: 4 additions & 0 deletions tests/stubtest_allowlists/py3_common.txt
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,10 @@ threading.Condition.release
multiprocessing.dummy.Condition.acquire
multiprocessing.dummy.Condition.release

# Takes a "_warn" parameter at runtime
# for technical reasons; no need to expose it in the stub.
asyncio.proactor_events._ProactorBasePipeTransport.__del__

# Weird special builtins that are typed as functions, but aren't functions
builtins.copyright
builtins.credits
Expand Down
4 changes: 4 additions & 0 deletions tests/stubtest_allowlists/win32.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,7 @@ pathlib.Path.group
# but have yet to find their way to all GitHub Actions images
(sys.get_int_max_str_digits)?
(sys.set_int_max_str_digits)?

# Takes a "_warn" parameter at runtime
# for technical reasons; no need to expose it in the stub.
asyncio.windows_utils.PipeHandle.__del__