@@ -80,6 +80,7 @@ class SSLCertVerificationError(SSLError, ValueError):
8080CertificateError = SSLCertVerificationError
8181
8282if 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
134135if 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
137139def 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