Skip to content

Commit a6dc624

Browse files
committed
mark versionadded for recv_into
1 parent 54202ae commit a6dc624

File tree

2 files changed

+3
-38
lines changed

2 files changed

+3
-38
lines changed

zmq/backend/cffi/socket.py

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -338,43 +338,6 @@ def recv(self, flags=0, copy=True, track=False):
338338
return _bytes
339339

340340
def recv_into(self, buffer, /, *, nbytes: int = 0, flags: int = 0) -> int:
341-
"""
342-
Receive up to nbytes bytes from the socket,
343-
storing the data into a buffer rather than allocating a new Frame.
344-
345-
A message frame can be discarded by receiving into an empty buffer::
346-
347-
sock.recv_into(bytearray())
348-
349-
Parameters
350-
----------
351-
buffer : memoryview
352-
Any object providing the buffer interface (i.e. `memoryview(buffer)` works),
353-
where the memoryview is contiguous and writable.
354-
nbytes: int, default=0
355-
The maximum number of bytes to receive.
356-
If nbytes is not specified (or 0), receive up to the size available in the given buffer.
357-
If the next frame is larger than this, the frame will be truncated and message content discarded.
358-
flags: int, default=0
359-
See `socket.recv`
360-
361-
Returns
362-
-------
363-
bytes_received: int
364-
Returns the number of bytes received.
365-
This is always the size of the received frame.
366-
If the returned `bytes_received` is larger than `nbytes` (or size of `buffer` if `nbytes=0`),
367-
the message has been truncated and the rest of the frame discarded.
368-
Truncated data cannot be recovered.
369-
370-
Raises
371-
------
372-
ZMQError
373-
for any of the reasons `zmq_recv` might fail.
374-
ValueError
375-
for invalid inputs, such as readonly or not contiguous buffers,
376-
or invalid nbytes.
377-
"""
378341
view = memoryview(buffer)
379342
if not view.contiguous:
380343
raise ValueError("Can only recv_into contiguous buffers")

zmq/backend/cython/_zmq.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1201,10 +1201,12 @@ def recv_into(self, buffer, /, *, nbytes=0, flags=0) -> C.int:
12011201
Receive up to nbytes bytes from the socket,
12021202
storing the data into a buffer rather than allocating a new Frame.
12031203
1204-
A message frame can be discarded by receiving into an empty buffer::
1204+
The next message frame can be discarded by receiving into an empty buffer::
12051205
12061206
sock.recv_into(bytearray())
12071207
1208+
.. versionadded:: 26.4
1209+
12081210
Parameters
12091211
----------
12101212
buffer : memoryview

0 commit comments

Comments
 (0)