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

Method close

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

Source from the content-addressed store, hash-verified

1302 return _BufferedIOMixin.seek(self, pos, whence)
1303
1304 def close(self):
1305 with self._write_lock:
1306 if self.raw is None or self.closed:
1307 return
1308 # We have to release the lock and call self.flush() (which will
1309 # probably just re-take the lock) in case flush has been overridden in
1310 # a subclass or the user set self.flush to something. This is the same
1311 # behavior as the C implementation.
1312 try:
1313 # may raise BlockingIOError or BrokenPipeError etc
1314 self.flush()
1315 finally:
1316 with self._write_lock:
1317 self.raw.close()
1318
1319
1320class BufferedRWPair(BufferedIOBase):

Callers

nothing calls this directly

Calls 2

flushMethod · 0.95
closeMethod · 0.45

Tested by

no test coverage detected