Skip to content

[ssl] Deprecate several features #14432

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 4 commits into from
Jul 26, 2025
Merged
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
10 changes: 7 additions & 3 deletions stdlib/ssl.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ class SSLCertVerificationError(SSLError, ValueError):
CertificateError = SSLCertVerificationError

if sys.version_info < (3, 12):
@deprecated("Deprecated since Python 3.7. Removed in Python 3.12. Use `SSLContext.wrap_socket()` instead.")
def wrap_socket(
sock: socket.socket,
keyfile: StrOrBytesPath | None = None,
Expand Down Expand Up @@ -132,6 +133,7 @@ else:
_create_default_https_context: Callable[..., SSLContext]

if sys.version_info < (3, 12):
@deprecated("Deprecated since Python 3.7. Removed in Python 3.12.")
def match_hostname(cert: _PeerCertRetDictType, hostname: str) -> None: ...

def cert_time_to_seconds(cert_time: str) -> int: ...
Expand Down Expand Up @@ -416,9 +418,11 @@ class SSLContext(_SSLContext):
if sys.version_info >= (3, 10):
security_level: int
if sys.version_info >= (3, 10):
# Using the default (None) for the `protocol` parameter is deprecated,
# but there isn't a good way of marking that in the stub unless/until PEP 702 is accepted
def __new__(cls, protocol: int | None = None, *args: Any, **kwargs: Any) -> Self: ...
@overload
def __new__(cls, protocol: int, *args: Any, **kwargs: Any) -> Self: ...
@overload
@deprecated("Deprecated since Python 3.10. Use a specific version of the SSL protocol.")
def __new__(cls, protocol: None = None, *args: Any, **kwargs: Any) -> Self: ...
else:
def __new__(cls, protocol: int = ..., *args: Any, **kwargs: Any) -> Self: ...

Expand Down
Loading