Skip to content

Fix signature of http.client.HTTPSConnection for Python3.12 #10392

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 26 additions & 13 deletions stdlib/http/client.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import email.message
import io
import ssl
import sys
import types
from _typeshed import ReadableBuffer, SupportsRead, WriteableBuffer
from collections.abc import Callable, Iterable, Iterator, Mapping
Expand Down Expand Up @@ -175,19 +176,31 @@ class HTTPConnection:
class HTTPSConnection(HTTPConnection):
# Can be `None` if `.connect()` was not called:
sock: ssl.SSLSocket | Any
def __init__(
self,
host: str,
port: int | None = None,
key_file: str | None = None,
cert_file: str | None = None,
timeout: float | None = ...,
source_address: tuple[str, int] | None = None,
*,
context: ssl.SSLContext | None = None,
check_hostname: bool | None = None,
blocksize: int = 8192,
) -> None: ...
if sys.version_info >= (3, 12):
def __init__(
self,
host: str,
port: str | None = None,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was it intentional to change this to str? I'm fairly sure this is incorrect...

*,
timeout: float | None = ...,
source_address: tuple[str, int] | None = None,
context: ssl.SSLContext | None = None,
blocksize: int = 8192,
) -> None: ...
else:
def __init__(
self,
host: str,
port: int | None = None,
key_file: str | None = None,
cert_file: str | None = None,
timeout: float | None = ...,
source_address: tuple[str, int] | None = None,
*,
context: ssl.SSLContext | None = None,
check_hostname: bool | None = None,
blocksize: int = 8192,
) -> None: ...

class HTTPException(Exception): ...

Expand Down
1 change: 0 additions & 1 deletion tests/stubtest_allowlists/py312.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ genericpath.__all__
genericpath.islink
gzip.GzipFile.filename
http.client.HTTPConnection.get_proxy_response_headers
http.client.HTTPSConnection.__init__
imaplib.IMAP4_SSL.__init__
importlib.abc.Finder
importlib.abc.Loader.module_repr
Expand Down