def _close(self): notify_close(self._fileno) self._mark_as_closed() try: os.close(self._fileno) except: # os.close may fail if __init__ didn't complete # (i.e file dscriptor passed to popen was invalid pass
def close(self): if not self._closed: self._closed = True _original_os.close(self._fileno) notify_close(self._fileno) for method in [ 'fileno', 'flush', 'isatty', 'next', 'read', 'readinto', 'readline', 'readlines', 'seek', 'tell', 'truncate', 'write', 'xreadlines', '__iter__', '__next__', 'writelines']: setattr(self, method, _operation_on_closed_file)
def close(self): if not self._closed: _original_os.close(self._fileno) self._closed = True notify_close(self._fileno) for method in [ 'fileno', 'flush', 'isatty', 'next', 'read', 'readinto', 'readline', 'readlines', 'seek', 'tell', 'truncate', 'write', 'xreadlines', '__iter__', '__next__', 'writelines']: setattr(self, method, _operation_on_closed_file)
def _close(self): was_closed = self._mark_as_closed() if was_closed: return if notify_close: # If closing from __del__, notify_close may have # already been cleaned up and set to None notify_close(self._fileno) try: os.close(self._fileno) except: # os.close may fail if __init__ didn't complete # (i.e file dscriptor passed to popen was invalid pass
def close(self): if not self._closed: self._closed = True _original_os.close(self._fileno) notify_close(self._fileno) for method in [ "fileno", "flush", "isatty", "next", "read", "readinto", "readline", "readlines", "seek", "tell", "truncate", "write", "xreadlines", "__iter__", "__next__", "writelines", ]: setattr(self, method, _operation_on_closed_file)
def close(self): notify_close(self.fd) self._mark_as_closed() return self.fd.close()
def close(self): notify_close(self.fd) self._mark_as_closed() # Don't do this twice. return self.fd.close()
def _mark_as_closed(self): """ Mark this socket as being closed """ self._closed = True notify_close(self.fileno)
def close(self): notify_close(self._fd) try: os.close(self._fd) except: pass