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

- ssl._create_unverified_context allows None since 3.10:
  https://github.com/python/cpython/commit/2875c603b2a7691b55c2046aca54831c91efda8e#diff-f6439be9c66350dde4c35dbeea0352c96cc970ba12b0478f6ae36f10725bd8c5
- sysconfig.is_python_build ignores its argument since 3.11:
  https://github.com/python/cpython/commit/067597522a9002f3b8aff7f46033f10acb2381e4
  (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
+28 -12
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]
+7 -1
View File
@@ -32,7 +32,13 @@ def get_path(name: str, scheme: str = ..., vars: dict[str, Any] | None = ..., ex
def get_paths(scheme: str = ..., vars: dict[str, Any] | None = ..., expand: bool = ...) -> dict[str, str]: ...
def get_python_version() -> str: ...
def get_platform() -> str: ...
def is_python_build(check_home: bool = ...) -> bool: ...
if sys.version_info >= (3, 11):
def is_python_build(check_home: object = None) -> bool: ...
else:
def is_python_build(check_home: bool = False) -> bool: ...
def parse_config_h(fp: IO[Any], vars: dict[str, Any] | None = ...) -> dict[str, Any]: ...
def get_config_h_filename() -> str: ...
def get_makefile_filename() -> str: ...