Skip to content

ssl: Add missing constants & classes #1569

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 2 commits into from
Aug 29, 2017
Merged

ssl: Add missing constants & classes #1569

merged 2 commits into from
Aug 29, 2017

Conversation

jaens
Copy link
Contributor

@jaens jaens commented Aug 21, 2017

See commit messages for details about how these were derived.

@jaens jaens changed the title ssl: Add missing PROTOCOL_TLS constants ssl: Add missing constants & classes Aug 22, 2017
Copy link
Member

@JelleZijlstra JelleZijlstra left a comment

Choose a reason for hiding this comment

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

Thanks! Just one request for clarification.

stdlib/3/ssl.pyi Outdated
@@ -168,6 +175,10 @@ class SSLSocket(socket.socket):
context = ... # type: SSLContext
server_side = ... # type: bool
server_hostname = ... # type: Optional[str]
if sys.version_info >= (3, 6):
session = ... # type: SSLSession
Copy link
Member

Choose a reason for hiding this comment

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

Should these be Optional? It looks like they're None if self._sslobj is None. But maybe we shouldn't worry too much about that case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess they are technically optional since they only seem to be valid for in certain states (handshaken sockets).
That distinction is not represented in the type though, so it's somewhat of a philosophical question - for objects with different states, do we take the optimistic stance (assume that the object is in the right state) or make the client code always validate the state in strict mode (is not None)...

Copy link
Member

Choose a reason for hiding this comment

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

That makes sense; I don't think I have a general answer here.

@@ -237,6 +248,9 @@ if sys.version_info >= (3, 5):
context = ... # type: SSLContext
server_side = ... # type: bool
server_hostname = ... # type: Optional[str]
if sys.version_info >= (3, 6):
session = ... # type: Optional[SSLSession]
session_reused = ... # type: bool
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@JelleZijlstra JelleZijlstra merged commit 8700993 into python:master Aug 29, 2017
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 this pull request may close these issues.

2 participants