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

Method _flush_unlocked

Lib/_pyio.py:1296–1311  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1294 self._flush_unlocked()
1295
1296 def _flush_unlocked(self):
1297 if self.closed:
1298 raise ValueError("flush on closed file")
1299 while self._write_buf:
1300 try:
1301 n = self.raw.write(self._write_buf)
1302 except BlockingIOError:
1303 raise RuntimeError("self.raw should implement RawIOBase: it "
1304 "should not raise BlockingIOError")
1305 if n is None:
1306 raise BlockingIOError(
1307 errno.EAGAIN,
1308 "write could not complete without blocking", 0)
1309 if n > len(self._write_buf) or n < 0:
1310 raise OSError("write() returned incorrect number of bytes")
1311 del self._write_buf[:n]
1312
1313 def tell(self):
1314 return _BufferedIOMixin.tell(self) + len(self._write_buf)

Callers 4

writeMethod · 0.95
truncateMethod · 0.95
flushMethod · 0.95
seekMethod · 0.95

Calls 1

writeMethod · 0.45

Tested by

no test coverage detected