Skip to content

Commit b94afb4

Browse files
committed
Update get_buffer docstring
1 parent 3e45d72 commit b94afb4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pymongo/network_layer.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,11 @@ async def read(self, request_id: Optional[int], max_message_size: int) -> tuple[
575575
raise OSError("connection closed")
576576

577577
def get_buffer(self, sizehint: int) -> memoryview:
578-
"""Called to allocate a new receive buffer."""
578+
"""Called to allocate a new receive buffer.
579+
The asyncio loop calls this method expecting to receive a non-empty buffer to fill with data.
580+
If any data does not fit into the returned buffer, this method will be called again until
581+
either no data remains or an empty buffer is returned.
582+
"""
579583
if self._overflow is not None:
580584
return self._overflow[self._overflow_index :]
581585
return self._buffer[self._end_index :]

0 commit comments

Comments
 (0)