Skip to content
Open
Changes from 2 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
4 changes: 2 additions & 2 deletions Doc/library/ssl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2600,8 +2600,8 @@ disabled by default.
::

>>> client_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
>>> client_context.minimum_version = ssl.TLSVersion.TLSv1_3
>>> client_context.maximum_version = ssl.TLSVersion.TLSv1_3
Copy link
Contributor Author

Choose a reason for hiding this comment

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

>>> client_context.minimum_version = ssl.TLSVersion.TLSv1_2
>>> client_context.maximum_version = ssl.TLSVersion.MAXIMUM_VERSION


The SSL context created above will only allow TLSv1.2 and later (if
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this states the context above supports TLSv1.2-max but the example was TLSv1.3 only

Copy link
Contributor

@janbrasna janbrasna Dec 19, 2023

Choose a reason for hiding this comment

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

@graingert If you update to current main the wording now states "TLSv1.3 and later" — so I'd recommend to match ssl.* min version with main too, but definitely propose the MAXIMUM_SUPPORTED anyways which makes much more sense compared to the current docs.

(While the docs specify "Deprecated since version 3.10: All TLSVersion members except TLSVersion.TLSv1_2 and TLSVersion.TLSv1_3 are deprecated." I believe that doesn't include the magic constants, as I can't see any proof in the deprecation warning code to raise any warnings for the MIN_/MAX_ constants, so it's just the description that's written too broadly.)

Copy link
Contributor

Choose a reason for hiding this comment

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

On the other hand, configuring the max version in this way is superfluous, as that is by the definition the default:

"SSLContext.maximum_version — A TLSVersion enum member representing the highest supported TLS version. The value defaults to TLSVersion.MAXIMUM_SUPPORTED."
https://docs.python.org/3/library/ssl.html#ssl.SSLContext.minimum_version

so there's no point of showing an example set this way.

I'd personally vouch for showing a real range as in #107273 (review)

Expand Down