8000 Asyncio socket-level methods do not support SSLSocket · Issue #122706 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content
Asyncio socket-level methods do not support SSLSocket #122706
Closed
@NoahStapp

Description

@NoahStapp

Attempting to use a SSLSocket with theasyncio.loop.sock_sendall method and the other socket-level async functions raises the following error:

TypeError: Socket cannot be of type SSLSocket

This can be reproduced by the following if socket is a SSLSocket:

 await asyncio.wait_for(loop.sock_sendall(socket, buf), timeout=timeout) 

However, the ssl-nonblocking section of the docs says the following:

"See also: The asyncio module supports non-blocking SSL sockets and provides a higher level API. It polls for events using the selectors module and handles SSLWantWriteError, SSLWantReadError and BlockingIOError exceptions. It runs the SSL handshake asynchronously as well."

Is this section specifically referencing the streams API as the SSL-compatible asyncio API? The current wording is unclear and suggests to me that non-blocking SSLSocket sockets are supported by asyncio, despite the error above. Is there a different section that specifies that SSLSocket is not supported by the socket-level asyncio API?

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0