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

Method close

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

Source from the content-addressed store, hash-verified

1321 return _BufferedIOMixin.seek(self, pos, whence)
1322
1323 def close(self):
1324 with self._write_lock:
1325 if self.raw is None or self.closed:
1326 return
1327 # We have to release the lock and call self.flush() (which will
1328 # probably just re-take the lock) in case flush has been overridden in
1329 # a subclass or the user set self.flush to something. This is the same
1330 # behavior as the C implementation.
1331 try:
1332 # may raise BlockingIOError or BrokenPipeError etc
1333 self.flush()
1334 finally:
1335 with self._write_lock:
1336 self.raw.close()
1337
1338
1339class BufferedRWPair(BufferedIOBase):

Callers

nothing calls this directly

Calls 2

flushMethod · 0.95
closeMethod · 0.45

Tested by

no test coverage detected