diff --git a/stdlib/ftplib.pyi b/stdlib/ftplib.pyi index 4275888f5..4a281a0ee 100644 --- a/stdlib/ftplib.pyi +++ b/stdlib/ftplib.pyi @@ -1,3 +1,4 @@ +import sys from _typeshed import Self, SupportsRead, SupportsReadline from socket import socket from ssl import SSLContext @@ -32,20 +33,37 @@ class FTP: lastresp: str file: TextIO | None encoding: str + + # The following variable is intentionally left undocumented. + # See https://bugs.python.org/issue43285 for relevant discussion + # trust_server_pasv_ipv4_address: bool def __enter__(self: Self) -> Self: ... def __exit__( self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> None: ... source_address: Tuple[str, int] | None - def __init__( - self, - host: str = ..., - user: str = ..., - passwd: str = ..., - acct: str = ..., - timeout: float = ..., - source_address: Tuple[str, int] | None = ..., - ) -> None: ... + if sys.version_info >= (3, 9): + def __init__( + self, + host: str = ..., + user: str = ..., + passwd: str = ..., + acct: str = ..., + timeout: float = ..., + source_address: Tuple[str, int] | None = ..., + *, + encoding: str = ..., + ) -> None: ... + else: + def __init__( + self, + host: str = ..., + user: str = ..., + passwd: str = ..., + acct: str = ..., + timeout: float = ..., + source_address: Tuple[str, int] | None = ..., + ) -> None: ... def connect( self, host: str = ..., port: int = ..., timeout: float = ..., source_address: Tuple[str, int] | None = ... ) -> str: ... @@ -100,18 +118,34 @@ class FTP: def close(self) -> None: ... class FTP_TLS(FTP): - def __init__( - self, - host: str = ..., - user: str = ..., - passwd: str = ..., - acct: str = ..., - keyfile: str | None = ..., - certfile: str | None = ..., - context: SSLContext | None = ..., - timeout: float = ..., - source_address: Tuple[str, int] | None = ..., - ) -> None: ... + if sys.version_info >= (3, 9): + def __init__( + self, + host: str = ..., + user: str = ..., + passwd: str = ..., + acct: str = ..., + keyfile: str | None = ..., + certfile: str | None = ..., + context: SSLContext | None = ..., + timeout: float = ..., + source_address: Tuple[str, int] | None = ..., + *, + encoding: str = ..., + ) -> None: ... + else: + def __init__( + self, + host: str = ..., + user: str = ..., + passwd: str = ..., + acct: str = ..., + keyfile: str | None = ..., + certfile: str | None = ..., + context: SSLContext | None = ..., + timeout: float = ..., + source_address: Tuple[str, int] | None = ..., + ) -> None: ... ssl_version: int keyfile: str | None certfile: str | None