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]

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: ...

View File

@@ -55,7 +55,6 @@ unittest.case.TestCase.__init_subclass__
# but in 3.10+ calling the function without the default argument is in fact deprecated,
# so it's better to ignore stubtest
ssl.SSLContext.__new__
ssl._create_unverified_context
# SpooledTemporaryFile implements IO except these methods before Python 3.11
# See also https://github.com/python/typeshed/pull/2452#issuecomment-420657918

View File

@@ -51,7 +51,6 @@ unittest.case.TestCase.__init_subclass__
# but in 3.10+ calling the function without the default argument is in fact deprecated,
# so it's better to ignore stubtest
ssl.SSLContext.__new__
ssl._create_unverified_context
# ==========
# Related to positional-only arguments
@@ -128,12 +127,6 @@ ast.ImportFrom.level # None on the class, but never None on instances
contextlib.AbstractAsyncContextManager.__class_getitem__
contextlib.AbstractContextManager.__class_getitem__
# The argument to is_python_build() is deprecated since Python 3.11 and
# has a default value of None to check for its existence and warn if it's
# supplied. None is not supposed to be passed by user code and therefore
# not included in the stubs.
sysconfig.is_python_build
# Super-special typing primitives
typing._SpecialForm.__mro_entries__
typing._TypedDict.__delitem__