ssl, sysconfig: fix issues with defaults (#9507)

- ssl._create_unverified_context allows None since 3.10:
  2875c603b2 (diff-f6439be9c66350dde4c35dbeea0352c96cc970ba12b0478f6ae36f10725bd8c5)
- sysconfig.is_python_build ignores its argument since 3.11:
  067597522a
  (was backported into 3.11)
This commit is contained in:
Jelle Zijlstra
2023-01-12 10:19:41 -08:00
committed by GitHub
parent aad1a14890
commit b43e1db47b
4 changed files with 35 additions and 21 deletions

View File

@@ -63,18 +63,34 @@ def create_default_context(
capath: StrOrBytesPath | None = ...,
cadata: str | ReadableBuffer | None = ...,
) -> SSLContext: ...
def _create_unverified_context(
protocol: int = ...,
*,
cert_reqs: int = ...,
check_hostname: bool = ...,
purpose: Purpose = ...,
certfile: StrOrBytesPath | None = ...,
keyfile: StrOrBytesPath | None = ...,
cafile: StrOrBytesPath | None = ...,
capath: StrOrBytesPath | None = ...,
cadata: str | ReadableBuffer | None = ...,
) -> SSLContext: ...
if sys.version_info >= (3, 10):
def _create_unverified_context(
protocol: int | None = None,
*,
cert_reqs: int = ...,
check_hostname: bool = ...,
purpose: Purpose = ...,
certfile: StrOrBytesPath | None = ...,
keyfile: StrOrBytesPath | None = ...,
cafile: StrOrBytesPath | None = ...,
capath: StrOrBytesPath | None = ...,
cadata: str | ReadableBuffer | None = ...,
) -> SSLContext: ...
else:
def _create_unverified_context(
protocol: int = ...,
*,
cert_reqs: int = ...,
check_hostname: bool = ...,
purpose: Purpose = ...,
certfile: StrOrBytesPath | None = ...,
keyfile: StrOrBytesPath | None = ...,
cafile: StrOrBytesPath | None = ...,
capath: StrOrBytesPath | None = ...,
cadata: str | ReadableBuffer | None = ...,
) -> SSLContext: ...
_create_default_https_context: Callable[..., SSLContext]