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

Method _recv_bytes

Lib/multiprocessing/connection.py:310–340  ·  view source on GitHub ↗
(self, maxsize=None)

Source from the content-addressed store, hash-verified

308 assert nwritten == len(buf)
309
310 def _recv_bytes(self, maxsize=None):
311 if self._got_empty_message:
312 self._got_empty_message = False
313 return io.BytesIO()
314 else:
315 bsize = 128 if maxsize is None else min(maxsize, 128)
316 try:
317 ov, err = _winapi.ReadFile(self._handle, bsize,
318 overlapped=True)
319 try:
320 if err == _winapi.ERROR_IO_PENDING:
321 waitres = _winapi.WaitForMultipleObjects(
322 [ov.event], False, INFINITE)
323 assert waitres == WAIT_OBJECT_0
324 except:
325 ov.cancel()
326 raise
327 finally:
328 nread, err = ov.GetOverlappedResult(True)
329 if err == 0:
330 f = io.BytesIO()
331 f.write(ov.getbuffer())
332 return f
333 elif err == _winapi.ERROR_MORE_DATA:
334 return self._get_more_data(ov, maxsize)
335 except OSError as e:
336 if e.winerror == _winapi.ERROR_BROKEN_PIPE:
337 raise EOFError
338 else:
339 raise
340 raise RuntimeError("shouldn't get here; expected KeyboardInterrupt")
341
342 def _poll(self, timeout):
343 if (self._got_empty_message or

Callers

nothing calls this directly

Calls 7

writeMethod · 0.95
_get_more_dataMethod · 0.95
minFunction · 0.85
ReadFileMethod · 0.80
GetOverlappedResultMethod · 0.80
cancelMethod · 0.45
getbufferMethod · 0.45

Tested by

no test coverage detected