MCPcopy Index your code
hub / github.com/python/cpython / send_bytes

Method send_bytes

Lib/multiprocessing/connection.py:189–207  ·  view source on GitHub ↗

Send the bytes data from a bytes-like object

(self, buf, offset=0, size=None)

Source from the content-addressed store, hash-verified

187 self._handle = None
188
189 def send_bytes(self, buf, offset=0, size=None):
190 """Send the bytes data from a bytes-like object"""
191 self._check_closed()
192 self._check_writable()
193 m = memoryview(buf)
194 if m.itemsize > 1:
195 m = m.cast('B')
196 n = m.nbytes
197 if offset < 0:
198 raise ValueError("offset is negative")
199 if n < offset:
200 raise ValueError("buffer length < offset")
201 if size is None:
202 size = n - offset
203 elif size < 0:
204 raise ValueError("size is negative")
205 elif offset + size > n:
206 raise ValueError("buffer length < offset + size")
207 self._send_bytes(m[offset:offset + size])
208
209 def send(self, obj):
210 """Send a (picklable) object"""

Callers 6

wakeupMethod · 0.45
putMethod · 0.45
deliver_challengeFunction · 0.45
answer_challengeFunction · 0.45
sendMethod · 0.45
sendMethod · 0.45

Calls 4

_check_closedMethod · 0.95
_check_writableMethod · 0.95
castMethod · 0.80
_send_bytesMethod · 0.45

Tested by

no test coverage detected