Skip to content

HTTPSConnection.__init__(port=) incorrectly annotated as str | None for 3.12 #11057

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

Closed
allisonkarlitskaya opened this issue Nov 22, 2023 · 2 comments · Fixed by #11058
Closed

Comments

@allisonkarlitskaya
Copy link
Contributor

This was introduced in #10392.

As far as I can tell by reading the code, it's only ever valid to give an integer or None. This matches the (correct) typeshed annotations for HTTPConnection and versions before Python 3.12. The problem seems to be specific to HTTPSConnection and Python 3.12.

@sobolevn
Copy link
Member

sobolevn commented Nov 22, 2023

Hm, indeed it looks like int for port is correct. Please, send a PR :)

port: int
sock: socket | Any # can be `None` if `.connect()` was not called
def __init__(
self,
host: str,
port: int | None = None,

Implementation: https://github.com/python/cpython/blob/bfc6d91c784c428c6f5c706a316cdce9140c4753/Lib/http/client.py#L920

@allisonkarlitskaya
Copy link
Contributor Author

Please, send a PR :)

tada: #11058

allisonkarlitskaya added a commit to allisonkarlitskaya/typeshed that referenced this issue Nov 22, 2023
Fix an apparent typo in the type of this field.

Closes python#11057
AlexWaygood pushed a commit that referenced this issue Nov 22, 2023
Fix an apparent typo in the type of this field.

Closes #11057
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants