Skip to content
Open
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
9 changes: 6 additions & 3 deletions stdlib/multiprocessing/connection.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ from typing_extensions import Self
__all__ = ["Client", "Listener", "Pipe", "wait"]

# https://docs.python.org/3/library/multiprocessing.html#address-formats
_Address: TypeAlias = str | tuple[str, int]
# bytes: Linux abstract AF_UNIX socket name (starts with a null byte)
_Address: TypeAlias = str | bytes | tuple[str, int]

# Defaulting to Any to avoid forcing generics on a lot of pre-existing code
_SendT_contra = TypeVar("_SendT_contra", contravariant=True, default=Any)
Expand Down Expand Up @@ -52,10 +53,12 @@ class Listener:
def accept(self) -> Connection[Incomplete, Incomplete] | PipeConnection[Incomplete, Incomplete]: ...

def close(self) -> None: ...
# Any: the concrete type depends on the address family and platform
# (e.g. str or bytes for AF_UNIX), cf. _socket._RetAddress
@property
def address(self) -> _Address: ...
def address(self) -> Any: ...
@property
def last_accepted(self) -> _Address | None: ...
def last_accepted(self) -> Any | None: ...
def __enter__(self) -> Self: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, exc_tb: TracebackType | None
Expand Down
Loading