Skip to content

fix: add missing multiprocessing.forkserver type hints #8406

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Jul 27, 2022
32 changes: 32 additions & 0 deletions stdlib/multiprocessing/forkserver.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from _typeshed import FileDescriptorLike
from collections.abc import Sequence
from struct import Struct
from typing import Any

__all__ = ["ensure_running", "get_inherited_fds", "connect_to_new_process", "set_forkserver_preload"]

MAXFDS_TO_SEND: int
SIGNED_STRUCT: Struct

class ForkServer:
def __init__(self) -> None: ...
def set_forkserver_preload(self, modules_names: list[str]) -> None: ...
def get_inherited_fds(self) -> list[int] | None: ...
def connect_to_new_process(self, fds: Sequence[int]) -> tuple[int, int]: ...
def ensure_running(self) -> None: ...

def main(
listener_fd: int | None,
alive_r: FileDescriptorLike,
preload: Sequence[str],
main_path: str | None = ...,
sys_path: object | None = ...,
) -> None: ...
def read_signed(fd: int) -> Any: ...
def write_signed(fd: int, n: int) -> None: ...

_forkserver: ForkServer = ...
ensure_running = _forkserver.ensure_running
get_inherited_fds = _forkserver.get_inherited_fds
connect_to_new_process = _forkserver.connect_to_new_process
set_forkserver_preload = _forkserver.set_forkserver_preload