Skip to content

Commit c112de1

Browse files
pythongh-126890: Restore stripped ssl docstrings (pythonGH-127281)
1 parent bf21e21 commit c112de1

File tree

2 files changed

+114
-14
lines changed

2 files changed

+114
-14
lines changed

Modules/_ssl.c

+50-13
Original file line numberDiff line numberDiff line change
@@ -2162,11 +2162,17 @@ _ssl__SSLSocket_compression_impl(PySSLSocket *self)
21622162
@critical_section
21632163
@getter
21642164
_ssl._SSLSocket.context
2165+
2166+
This changes the context associated with the SSLSocket.
2167+
2168+
This is typically used from within a callback function set by the sni_callback
2169+
on the SSLContext to change the certificate information associated with the
2170+
SSLSocket before the cryptographic exchange handshake messages.
21652171
[clinic start generated code]*/
21662172

21672173
static PyObject *
21682174
_ssl__SSLSocket_context_get_impl(PySSLSocket *self)
2169-
/*[clinic end generated code: output=d23e82f72f32e3d7 input=25aa82e4d9fa344a]*/
2175+
/*[clinic end generated code: output=d23e82f72f32e3d7 input=7cbb97407c2ace30]*/
21702176
{
21712177
return Py_NewRef(self->ctx);
21722178
}
@@ -2233,11 +2239,15 @@ _ssl__SSLSocket_server_hostname_get_impl(PySSLSocket *self)
22332239
@critical_section
22342240
@getter
22352241
_ssl._SSLSocket.owner
2242+
2243+
The Python-level owner of this object.
2244+
2245+
Passed as "self" in servername callback.
22362246
[clinic start generated code]*/
22372247

22382248
static PyObject *
22392249
_ssl__SSLSocket_owner_get_impl(PySSLSocket *self)
2240-
/*[clinic end generated code: output=1f278cb930382927 input=bc2861ff3cf1402e]*/
2250+
/*[clinic end generated code: output=1f278cb930382927 input=978a8382d9c25c92]*/
22412251
{
22422252
if (self->owner == NULL) {
22432253
Py_RETURN_NONE;
@@ -2851,11 +2861,13 @@ _ssl__SSLSocket_verify_client_post_handshake_impl(PySSLSocket *self)
28512861
@critical_section
28522862
@getter
28532863
_ssl._SSLSocket.session
2864+
2865+
The underlying SSLSession object.
28542866
[clinic start generated code]*/
28552867

28562868
static PyObject *
28572869
_ssl__SSLSocket_session_get_impl(PySSLSocket *self)
2858-
/*[clinic end generated code: output=a5cd5755b35da670 input=b9792df9255a9f63]*/
2870+
/*[clinic end generated code: output=a5cd5755b35da670 input=d427318604244bf8]*/
28592871
{
28602872
/* get_session can return sessions from a server-side connection,
28612873
* it does not check for handshake done or client socket. */
@@ -3657,11 +3669,13 @@ _ssl__SSLContext_maximum_version_set_impl(PySSLContext *self,
36573669
@critical_section
36583670
@getter
36593671
_ssl._SSLContext.num_tickets
3672+
3673+
Control the number of TLSv1.3 session tickets.
36603674
[clinic start generated code]*/
36613675

36623676
static PyObject *
36633677
_ssl__SSLContext_num_tickets_get_impl(PySSLContext *self)
3664-
/*[clinic end generated code: output=3d06d016318846c9 input=1dee26d75163c073]*/
3678+
/*[clinic end generated code: output=3d06d016318846c9 input=1e2599a2e22564ff]*/
36653679
{
36663680
// Clinic seems to be misbehaving when the comment is wrapped with in directive
36673681
#if defined(TLS1_3_VERSION) && !defined(OPENSSL_NO_TLS1_3)
@@ -3705,11 +3719,13 @@ _ssl__SSLContext_num_tickets_set_impl(PySSLContext *self, PyObject *value)
37053719
@critical_section
37063720
@getter
37073721
_ssl._SSLContext.security_level
3722+
3723+
The current security level.
37083724
[clinic start generated code]*/
37093725

37103726
static PyObject *
37113727
_ssl__SSLContext_security_level_get_impl(PySSLContext *self)
3712-
/*[clinic end generated code: output=56ece09e6a9572d0 input=a0416598e07c3183]*/
3728+
/*[clinic end generated code: output=56ece09e6a9572d0 input=2bdeecb57bb86e3f]*/
37133729
{
37143730
PyObject *res = PyLong_FromLong(SSL_CTX_get_security_level(self->ctx));
37153731
return res;
@@ -4666,11 +4682,18 @@ _servername_callback(SSL *s, int *al, void *args)
46664682
@critical_section
46674683
@getter
46684684
_ssl._SSLContext.sni_callback
4685+
4686+
Set a callback that will be called when a server name is provided by the SSL/TLS client in the SNI extension.
4687+
4688+
If the argument is None then the callback is disabled. The method is called
4689+
with the SSLSocket, the server name as a string, and the SSLContext object.
4690+
4691+
See RFC 6066 for details of the SNI extension.
46694692
[clinic start generated code]*/
46704693

46714694
static PyObject *
46724695
_ssl__SSLContext_sni_callback_get_impl(PySSLContext *self)
4673-
/*[clinic end generated code: output=961e6575cdfaf036 input=22dd28c31fdc4318]*/
4696+
/*[clinic end generated code: output=961e6575cdfaf036 input=9b2473c5e984cfe6]*/
46744697
{
46754698
PyObject *cb = self->set_sni_cb;
46764699
if (cb == NULL) {
@@ -5243,11 +5266,13 @@ memory_bio_dealloc(PySSLMemoryBIO *self)
52435266
@critical_section
52445267
@getter
52455268
_ssl.MemoryBIO.pending
5269+
5270+
The number of bytes pending in the memory BIO.
52465271
[clinic start generated code]*/
52475272

52485273
static PyObject *
52495274
_ssl_MemoryBIO_pending_get_impl(PySSLMemoryBIO *self)
5250-
/*[clinic end generated code: output=19236a32a51ac8ff input=c0b6d14eba107f6a]*/
5275+
/*[clinic end generated code: output=19236a32a51ac8ff input=02d9063d8ac31732]*/
52515276
{
52525277
size_t res = BIO_ctrl_pending(self->bio);
52535278
return PyLong_FromSize_t(res);
@@ -5257,11 +5282,13 @@ _ssl_MemoryBIO_pending_get_impl(PySSLMemoryBIO *self)
52575282
@critical_section
52585283
@getter
52595284
_ssl.MemoryBIO.eof
5285+
5286+
Whether the memory BIO is at EOF.
52605287
[clinic start generated code]*/
52615288

52625289
static PyObject *
52635290
_ssl_MemoryBIO_eof_get_impl(PySSLMemoryBIO *self)
5264-
/*[clinic end generated code: output=c255a9ea16e31b92 input=0f5c6be69752e04c]*/
5291+
/*[clinic end generated code: output=c255a9ea16e31b92 input=c6ecc12c4509de1f]*/
52655292
{
52665293
size_t pending = BIO_ctrl_pending(self->bio);
52675294
return PyBool_FromLong((pending == 0) && self->eof_written);
@@ -5502,11 +5529,13 @@ PySSLSession_clear(PySSLSession *self)
55025529
@critical_section
55035530
@getter
55045531
_ssl.SSLSession.time
5532+
5533+
Session creation time (seconds since epoch).
55055534
[clinic start generated code]*/
55065535

55075536
static PyObject *
55085537
_ssl_SSLSession_time_get_impl(PySSLSession *self)
5509-
/*[clinic end generated code: output=4b887b9299de9be4 input=8d1e4afd09103279]*/
5538+
/*[clinic end generated code: output=4b887b9299de9be4 input=67f2325284450ae2]*/
55105539
{
55115540
#if OPENSSL_VERSION_NUMBER >= 0x30300000L
55125541
return _PyLong_FromTime_t(SSL_SESSION_get_time_ex(self->session));
@@ -5519,11 +5548,13 @@ _ssl_SSLSession_time_get_impl(PySSLSession *self)
55195548
@critical_section
55205549
@getter
55215550
_ssl.SSLSession.timeout
5551+
5552+
Session timeout (delta in seconds).
55225553
[clinic start generated code]*/
55235554

55245555
static PyObject *
55255556
_ssl_SSLSession_timeout_get_impl(PySSLSession *self)
5526-
/*[clinic end generated code: output=82339c148ab2f7d1 input=ae5e84a9d85df60d]*/
5557+
/*[clinic end generated code: output=82339c148ab2f7d1 input=cd17c2b087c442f2]*/
55275558
{
55285559
long timeout = SSL_SESSION_get_timeout(self->session);
55295560
PyObject *res = PyLong_FromLong(timeout);
@@ -5534,11 +5565,13 @@ _ssl_SSLSession_timeout_get_impl(PySSLSession *self)
55345565
@critical_section
55355566
@getter
55365567
_ssl.SSLSession.ticket_lifetime_hint
5568+
5569+
Ticket life time hint.
55375570
[clinic start generated code]*/
55385571

55395572
static PyObject *
55405573
_ssl_SSLSession_ticket_lifetime_hint_get_impl(PySSLSession *self)
5541-
/*[clinic end generated code: output=c8b6db498136c275 input=d0e06942ddd8d07f]*/
5574+
/*[clinic end generated code: output=c8b6db498136c275 input=f0e2df50961a7806]*/
55425575
{
55435576
unsigned long hint = SSL_SESSION_get_ticket_lifetime_hint(self->session);
55445577
return PyLong_FromUnsignedLong(hint);
@@ -5548,11 +5581,13 @@ _ssl_SSLSession_ticket_lifetime_hint_get_impl(PySSLSession *self)
55485581
@critical_section
55495582
@getter
55505583
_ssl.SSLSession.id
5584+
5585+
Session ID.
55515586
[clinic start generated code]*/
55525587

55535588
static PyObject *
55545589
_ssl_SSLSession_id_get_impl(PySSLSession *self)
5555-
/*[clinic end generated code: output=c532fb96b10c5adf input=e7322372cf6325dd]*/
5590+
/*[clinic end generated code: output=c532fb96b10c5adf input=0a379e64312b776d]*/
55565591

55575592
{
55585593
const unsigned char *id;
@@ -5565,11 +5600,13 @@ _ssl_SSLSession_id_get_impl(PySSLSession *self)
55655600
@critical_section
55665601
@getter
55675602
_ssl.SSLSession.has_ticket
5603+
5604+
Does the session contain a ticket?
55685605
[clinic start generated code]*/
55695606

55705607
static PyObject *
55715608
_ssl_SSLSession_has_ticket_get_impl(PySSLSession *self)
5572-
/*[clinic end generated code: output=aa3ccfc40b10b96d input=1a48ae8955fa9601]*/
5609+
/*[clinic end generated code: output=aa3ccfc40b10b96d input=fa475555f53a5086]*/
55735610
{
55745611
int res = SSL_SESSION_has_ticket(self->session);
55755612
return res ? Py_True : Py_False;

Modules/clinic/_ssl.c.h

+64-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)