Skip to content
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

gh-126890: Restore stripped ssl docstrings #127281

Merged
merged 20 commits into from
Dec 2, 2024

Conversation

ZeroIntensity
Copy link
Member

@ZeroIntensity ZeroIntensity commented Nov 26, 2024

In GH-124993, I forgot to carry over some of the docstrings to AC. This adds all of them back.

@encukou
Copy link
Member

encukou commented Nov 26, 2024

At a first glance at those warnings, it looks like this might need some changes in clinic :(
Shout if you want me to help.

@neonene
Copy link
Contributor

neonene commented Nov 26, 2024

Please add a docstring for _ssl.MemoryBIO.pending.

I think the warnings are related to the following regression:

3.12 on Windows:

>>> help(_ssl._SSLSocket.context)
Help on getset descriptor _ssl._SSLSocket.context:

context
    _setter_context(ctx)
    This changes the context associated with the SSLSocket. This is typically
    used from within a callback function set by the sni_callback
    on the SSLContext to change the certificate information associated with the
    SSLSocket before the cryptographic exchange handshake messages
>>>

This PR:

>>> help(_ssl._SSLSocket.context)
Help on getset descriptor _ssl._SSLSocket.context:

context

>>>

@ZeroIntensity
Copy link
Member Author

As far as I can tell, the warnings are a clinic bug.

@erlend-aasland
Copy link
Contributor

Can we tear out the Argument Clinic bug fix as a separate PR?

@ZeroIntensity
Copy link
Member Author

Yeah, I'll do that. A fair warning: it might take me a little while to get the PR up; I'm currently on a slow connection and GitHub takes forever.

@neonene
Copy link
Contributor

neonene commented Dec 1, 2024

Thanks. I confirmed the following 16 PyDoc_STRVAR()s' migration on this PR:

PyDoc_STRVAR(PySSL_set_context_doc, ...)
PyDoc_STRVAR(PySSL_get_server_side_doc, ...)
PyDoc_STRVAR(PySSL_get_server_hostname_doc, ...)
PyDoc_STRVAR(PySSL_get_owner_doc, ...)
PyDoc_STRVAR(PySSL_set_session_doc, ...)
PyDoc_STRVAR(PySSL_get_session_reused_doc, ...)
PyDoc_STRVAR(PySSLContext_num_tickets_doc, ...)
PyDoc_STRVAR(PySSLContext_security_level_doc, ...)
PyDoc_STRVAR(PySSLContext_sni_callback_doc, ...)
PyDoc_STRVAR(PySSL_memory_bio_pending_doc, ...)
PyDoc_STRVAR(PySSL_memory_bio_eof_doc, ...)
PyDoc_STRVAR(PySSLSession_get_time_doc, ...)
PyDoc_STRVAR(PySSLSession_get_timeout_doc, ...)
PyDoc_STRVAR(PySSLSession_get_ticket_lifetime_hint_doc, ...)
PyDoc_STRVAR(PySSLSession_get_session_id_doc, ...)
PyDoc_STRVAR(PySSLSession_get_has_ticket_doc, ...)
>>> help(_ssl._SSLSocket.context)
Help on getset descriptor _ssl._SSLSocket.context:

context
    This changes the context associated with the SSLSocket.

    This is typically used from within a callback function set by the sni_callback
    on the SSLContext to change the certificate information associated with the
    SSLSocket before the cryptographic exchange handshake messages.

>>> help(_ssl._SSLSocket.server_side)
Help on getset descriptor _ssl._SSLSocket.server_side:

server_side
    Whether this is a server-side socket.

>>> help(_ssl._SSLSocket.server_hostname)
Help on getset descriptor _ssl._SSLSocket.server_hostname:

server_hostname
    The currently set server hostname (for SNI).

>>> help(_ssl._SSLSocket.owner)
Help on getset descriptor _ssl._SSLSocket.owner:

owner
    The Python-level owner of this object.

    Passed as "self" in servername callback.

>>> help(_ssl._SSLSocket.session)
Help on getset descriptor _ssl._SSLSocket.session:

session
    The underlying SSLSession object.

>>> help(_ssl._SSLSocket.session_reused)
Help on getset descriptor _ssl._SSLSocket.session_reused:

session_reused
    Was the client session reused during handshake?

>>> help(_ssl._SSLContext.num_tickets)
Help on getset descriptor _ssl._SSLContext.num_tickets:

num_tickets
    Control the number of TLSv1.3 session tickets.

>>> help(_ssl._SSLContext.security_level)
Help on getset descriptor _ssl._SSLContext.security_level:

security_level
    The current security level.

>>> help(_ssl._SSLContext.sni_callback)
Help on getset descriptor _ssl._SSLContext.sni_callback:

sni_callback
    Set a callback that will be called when a server name is provided by the SSL/TLS client in the SNI extension.

    If the argument is None then the callback is disabled. The method is called
    with the SSLSocket, the server name as a string, and the SSLContext object.

    See RFC 6066 for details of the SNI extension.

>>> help(_ssl.MemoryBIO.pending)
Help on getset descriptor _ssl.MemoryBIO.pending:

pending
    The number of bytes pending in the memory BIO.

>>> help(_ssl.MemoryBIO.eof)
Help on getset descriptor _ssl.MemoryBIO.eof:

eof
    Whether the memory BIO is at EOF.

>>> help(_ssl.SSLSession.time)
Help on getset descriptor _ssl.SSLSession.time:

time
    Session creation time (seconds since epoch).

>>> help(_ssl.SSLSession.timeout)
Help on getset descriptor _ssl.SSLSession.timeout:

timeout
    Session timeout (delta in seconds).

>>> help(_ssl.SSLSession.ticket_lifetime_hint)
Help on getset descriptor _ssl.SSLSession.ticket_lifetime_hint:

ticket_lifetime_hint
    Ticket life time hint.

>>> help(_ssl.SSLSession.id)
Help on getset descriptor _ssl.SSLSession.id:

id
    Session ID.

>>> help(_ssl.SSLSession.has_ticket)
Help on getset descriptor _ssl.SSLSession.has_ticket:

has_ticket
    Does the session contain a ticket?

>>>

@encukou encukou merged commit c112de1 into python:main Dec 2, 2024
39 checks passed
@encukou
Copy link
Member

encukou commented Dec 2, 2024

Thank you for following up!

@ZeroIntensity ZeroIntensity deleted the restore-stripped-ssl-docstrings branch December 2, 2024 13:12
@ZeroIntensity
Copy link
Member Author

@encukou, the 3.13 backport (GH-125780) just got merged for the original thread safety fix, so we have to backport this as well.

@ZeroIntensity ZeroIntensity added the needs backport to 3.13 bugs and security fixes label Dec 2, 2024
@miss-islington-app
Copy link

Thanks @ZeroIntensity for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Sorry, @ZeroIntensity and @encukou, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker c112de1da2d18e3b5c2ea30b0e409f18e574efd8 3.13

@ZeroIntensity
Copy link
Member Author

I figured that might happen :(. I'll look into it.

ZeroIntensity added a commit to ZeroIntensity/cpython that referenced this pull request Dec 2, 2024
…27281)

(cherry picked from commit c112de1)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
@bedevere-app
Copy link

bedevere-app bot commented Dec 2, 2024

GH-127513 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Dec 2, 2024
Yhg1s pushed a commit that referenced this pull request Dec 2, 2024
)

(cherry picked from commit c112de1)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants