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

Method cleanup

Lib/tempfile.py:455–469  ·  view source on GitHub ↗
(self, windows=(_os.name == 'nt'), unlink=_os.unlink)

Source from the content-addressed store, hash-verified

453 self.warn_message = warn_message
454
455 def cleanup(self, windows=(_os.name == 'nt'), unlink=_os.unlink):
456 if not self.cleanup_called:
457 self.cleanup_called = True
458 try:
459 if not self.close_called:
460 self.close_called = True
461 self.file.close()
462 finally:
463 # Windows provides delete-on-close as a primitive, in which
464 # case the file was deleted by self.file.close().
465 if self.delete and not (windows and self.delete_on_close):
466 try:
467 unlink(self.name)
468 except FileNotFoundError:
469 pass
470
471 def close(self):
472 if not self.close_called:

Callers 2

closeMethod · 0.95
__del__Method · 0.95

Calls 2

unlinkFunction · 0.85
closeMethod · 0.45

Tested by

no test coverage detected