[stdlib] Deprecate keyfile, certfile and check_hostname parameters (#15259)

This commit is contained in:
Semyon Moroz
2026-01-11 23:31:03 +01:00
committed by GitHub
parent 3593e35df4
commit a679bdc438
5 changed files with 125 additions and 28 deletions
+28 -8
View File
@@ -1,11 +1,11 @@
import sys
from _typeshed import SupportsRead, SupportsReadline
from _typeshed import StrOrBytesPath, SupportsRead, SupportsReadline
from collections.abc import Callable, Iterable, Iterator
from socket import socket
from ssl import SSLContext
from types import TracebackType
from typing import Any, Final, Literal, TextIO
from typing_extensions import Self
from typing import Any, Final, Literal, TextIO, overload
from typing_extensions import Self, deprecated
__all__ = ["FTP", "error_reply", "error_temp", "error_perm", "error_proto", "all_errors", "FTP_TLS"]
@@ -120,23 +120,43 @@ class FTP_TLS(FTP):
encoding: str = "utf-8",
) -> None: ...
else:
@overload
def __init__(
self,
host: str = "",
user: str = "",
passwd: str = "",
acct: str = "",
keyfile: str | None = None,
certfile: str | None = None,
keyfile: None = None,
certfile: None = None,
context: SSLContext | None = None,
timeout: float | None = ...,
source_address: tuple[str, int] | None = None,
*,
encoding: str = "utf-8",
) -> None: ...
ssl_version: int
keyfile: str | None
certfile: str | None
@overload
@deprecated(
"The `keyfile`, `certfile` parameters are deprecated since Python 3.6; "
"removed in Python 3.12. Use `context` parameter instead."
)
def __init__(
self,
host: str = "",
user: str = "",
passwd: str = "",
acct: str = "",
keyfile: StrOrBytesPath | None = None,
certfile: StrOrBytesPath | None = None,
context: None = None,
timeout: float | None = ...,
source_address: tuple[str, int] | None = None,
*,
encoding: str = "utf-8",
) -> None: ...
ssl_version: int
keyfile: StrOrBytesPath | None
certfile: StrOrBytesPath | None
context: SSLContext
def login(self, user: str = "", passwd: str = "", acct: str = "", secure: bool = True) -> str: ...
def auth(self) -> str: ...