Skip to content

Commit 7a2cb31

Browse files
committed
gh-150952: Fix incorrect sock_sendto docstring
1 parent 32104a1 commit 7a2cb31

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

Lib/asyncio/selector_events.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -584,13 +584,10 @@ def _sock_sendall(self, fut, sock, view, pos):
584584
pos[0] = start
585585

586586
async def sock_sendto(self, sock, data, address):
587-
"""Send data to the socket.
587+
"""Send a datagram from sock to address.
588588
589-
The socket must be connected to a remote socket. This method continues
590-
to send data from data until either all data has been sent or an
591-
error occurs. None is returned on success. On error, an exception is
592-
raised, and there is no way to determine how much data, if any, was
593-
successfully processed by the receiving end of the connection.
589+
The socket does not have to be connected. This method sends the
590+
whole datagram in a single call. Return the number of bytes sent.
594591
"""
595592
base_events._check_ssl_socket(sock)
596593
if self._debug and sock.gettimeout() != 0:
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Fix the docstring of :meth:`asyncio.loop.sock_sendto`, which was mistakenly
2+
copied from :meth:`asyncio.loop.sock_sendall` and described stream semantics
3+
instead of a datagram send.

0 commit comments

Comments
 (0)