Skip to content

Commit bdd6546

Browse files
authored
[ssl] Deprecate several features (#14432)
1 parent 6e474f2 commit bdd6546

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

stdlib/ssl.pyi

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ class SSLCertVerificationError(SSLError, ValueError):
8080
CertificateError = SSLCertVerificationError
8181

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

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

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

0 commit comments

Comments
 (0)