Skip to content

Commit 187ff2e

Browse files
committed
gh-136306: Address first round of comments
1 parent 03072c4 commit 187ff2e

2 files changed

Lines changed: 14 additions & 16 deletions

File tree

Doc/library/ssl.rst

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1645,17 +1645,15 @@ to speed up repeated connections from the same clients.
16451645

16461646
Get a list of groups implemented for key agreement, taking into account
16471647
the SSLContext's current TLS ``minimum_version`` and ``maximum_version``
1648-
values.
1648+
values. For example::
16491649

1650-
Example::
1651-
1652-
>>> ctx = ssl.create_default_context()
1653-
>>> ctx.minimum_version=ssl.TLSVersion.TLSv1_3
1654-
>>> ctx.maximum_version=ssl.TLSVersion.TLSv1_3
1655-
>>> ctx.get_groups()
1656-
['secp256r1', 'secp384r1', 'secp521r1', 'x25519', 'x448', 'brainpoolP256r1tls13', 'brainpoolP384r1tls13', 'brainpoolP512r1tls13', 'ffdhe2048', 'ffdhe3072', 'ffdhe4096', 'ffdhe6144', 'ffdhe8192', 'MLKEM512', 'MLKEM768', 'MLKEM1024', 'SecP256r1MLKEM768', 'X25519MLKEM768', 'SecP384r1MLKEM1024'
1650+
>>> ctx = ssl.create_default_context()
1651+
>>> ctx.minimum_version=ssl.TLSVersion.TLSv1_3
1652+
>>> ctx.maximum_version=ssl.TLSVersion.TLSv1_3
1653+
>>> ctx.get_groups()
1654+
['secp256r1', 'secp384r1', 'secp521r1', 'x25519', 'x448', 'brainpoolP256r1tls13', 'brainpoolP384r1tls13', 'brainpoolP512r1tls13', 'ffdhe2048', 'ffdhe3072', 'ffdhe4096', 'ffdhe6144', 'ffdhe8192', 'MLKEM512', 'MLKEM768', 'MLKEM1024', 'SecP256r1MLKEM768', 'X25519MLKEM768', 'SecP384r1MLKEM1024']
16571655

1658-
.. versionadded:: 3.15
1656+
.. versionadded:: next
16591657

16601658
.. method:: SSLContext.set_default_verify_paths()
16611659

@@ -1689,7 +1687,7 @@ to speed up repeated connections from the same clients.
16891687
<https://docs.openssl.org/master/man3/SSL_CTX_set1_groups_list/>`_.
16901688

16911689
.. note::
1692-
when connected, the :meth:`SSLSocket.group` method of SSL sockets will
1690+
When connected, the :meth:`SSLSocket.group` method of SSL sockets will
16931691
return the group used for key agreement on that connection.
16941692

16951693
.. versionadded:: 3.15
@@ -1817,10 +1815,6 @@ to speed up repeated connections from the same clients.
18171815

18181816
.. versionadded:: 3.3
18191817

1820-
.. deprecated:: 3.15
1821-
1822-
This method has been replaced by :math:`set_groups`.
1823-
18241818
.. seealso::
18251819
`SSL/TLS & Perfect Forward Secrecy <https://vincent.bernat.ch/en/blog/2011-ssl-perfect-forward-secrecy>`_
18261820
Vincent Bernat.

Modules/_ssl.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2154,11 +2154,15 @@ _ssl__SSLSocket_group_impl(PySSLSocket *self)
21542154
#if OPENSSL_VERSION_NUMBER >= 0x30200000L
21552155
const char *group_name;
21562156

2157-
if (self->ssl == NULL)
2157+
if (self->ssl == NULL) {
21582158
Py_RETURN_NONE;
2159+
}
2160+
21592161
group_name = SSL_get0_group_name(self->ssl);
2160-
if (group_name == NULL)
2162+
if (group_name == NULL) {
21612163
Py_RETURN_NONE;
2164+
}
2165+
21622166
return PyUnicode_DecodeFSDefault(group_name);
21632167
#else
21642168
PyErr_SetString(PyExc_NotImplementedError,

0 commit comments

Comments
 (0)