Skip to content

Commit 8162faa

Browse files
authored
Fix signature of http.client.HTTPSConnection for Python 3.12 (#10392)
1 parent a8051fb commit 8162faa

File tree

2 files changed

+26
-14
lines changed

2 files changed

+26
-14
lines changed

stdlib/http/client.pyi

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import email.message
22
import io
33
import ssl
4+
import sys
45
import types
56
from _typeshed import ReadableBuffer, SupportsRead, WriteableBuffer
67
from collections.abc import Callable, Iterable, Iterator, Mapping
@@ -175,19 +176,31 @@ class HTTPConnection:
175176
class HTTPSConnection(HTTPConnection):
176177
# Can be `None` if `.connect()` was not called:
177178
sock: ssl.SSLSocket | Any
178-
def __init__(
179-
self,
180-
host: str,
181-
port: int | None = None,
182-
key_file: str | None = None,
183-
cert_file: str | None = None,
184-
timeout: float | None = ...,
185-
source_address: tuple[str, int] | None = None,
186-
*,
187-
context: ssl.SSLContext | None = None,
188-
check_hostname: bool | None = None,
189-
blocksize: int = 8192,
190-
) -> None: ...
179+
if sys.version_info >= (3, 12):
180+
def __init__(
181+
self,
182+
host: str,
183+
port: str | None = None,
184+
*,
185+
timeout: float | None = ...,
186+
source_address: tuple[str, int] | None = None,
187+
context: ssl.SSLContext | None = None,
188+
blocksize: int = 8192,
189+
) -> None: ...
190+
else:
191+
def __init__(
192+
self,
193+
host: str,
194+
port: int | None = None,
195+
key_file: str | None = None,
196+
cert_file: str | None = None,
197+
timeout: float | None = ...,
198+
source_address: tuple[str, int] | None = None,
199+
*,
200+
context: ssl.SSLContext | None = None,
201+
check_hostname: bool | None = None,
202+
blocksize: int = 8192,
203+
) -> None: ...
191204

192205
class HTTPException(Exception): ...
193206

tests/stubtest_allowlists/py312.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ genericpath.__all__
3030
genericpath.islink
3131
gzip.GzipFile.filename
3232
http.client.HTTPConnection.get_proxy_response_headers
33-
http.client.HTTPSConnection.__init__
3433
imaplib.IMAP4_SSL.__init__
3534
importlib.abc.Finder
3635
importlib.abc.Loader.module_repr

0 commit comments

Comments
 (0)