MCPcopy Index your code
hub / github.com/RustPython/RustPython / readinto

Method readinto

Lib/socket.py:712–732  ·  view source on GitHub ↗

Read up to len(b) bytes into the writable buffer *b* and return the number of bytes read. If the socket is non-blocking and no bytes are available, None is returned. If *b* is non-empty, a 0 return value indicates that the connection was shutdown at the other end.

(self, b)

Source from the content-addressed store, hash-verified

710 self._timeout_occurred = False
711
712 def readinto(self, b):
713 """Read up to len(b) bytes into the writable buffer *b* and return
714 the number of bytes read. If the socket is non-blocking and no bytes
715 are available, None is returned.
716
717 If *b* is non-empty, a 0 return value indicates that the connection
718 was shutdown at the other end.
719 """
720 self._checkClosed()
721 self._checkReadable()
722 if self._timeout_occurred:
723 raise OSError("cannot read from timed out object")
724 try:
725 return self._sock.recv_into(b)
726 except timeout:
727 self._timeout_occurred = True
728 raise
729 except error as e:
730 if e.errno in _blocking_errnos:
731 return None
732 raise
733
734 def write(self, b):
735 """Write the given bytes or bytearray object *b* to the socket

Callers

nothing calls this directly

Calls 3

_checkClosedMethod · 0.45
_checkReadableMethod · 0.45
recv_intoMethod · 0.45

Tested by

no test coverage detected