Exemplo n.º 1
0
 def destructor(self):
     assert isinstance(self, W_File)
     try:
         self.direct_close()
     except StreamErrors, e:
         operr = wrap_streamerror(self.space, e, self.w_name)
         raise operr
Exemplo n.º 2
0
 def destructor(self):
     assert isinstance(self, W_File)
     try:
         self.direct_close()
     except StreamErrors, e:
         operr = wrap_streamerror(self.space, e, self.w_name)
         raise operr
Exemplo n.º 3
0
 def __del__(self):
     # assume that the file and stream objects are only visible in the
     # thread that runs __del__, so no race condition should be possible
     self.clear_all_weakrefs()
     try:
         self.direct_close()
     except StreamErrors, e:
         operr = wrap_streamerror(self.space, e, self.w_name)
         operr.write_unraisable(self.space, '__del__ of ', self)
Exemplo n.º 4
0
def get_file(space, w_file, filename, filemode):
    if w_file is None or space.is_w(w_file, space.w_None):
        try:
            return streamio.open_file_as_stream(filename, filemode)
        except StreamErrors, e:
            # XXX this is not quite the correct place, but it will do for now.
            # XXX see the issue which I'm sure exists already but whose number
            # XXX I cannot find any more...
            raise wrap_streamerror(space, e)
Exemplo n.º 5
0
 def file_fdopen(self, fd, mode="r", buffering=-1):
     try:
         self.direct_fdopen(fd, mode, buffering)
     except StreamErrors, e:
         raise wrap_streamerror(self.space, e)
Exemplo n.º 6
0
 def file_fdopen(self, fd, mode="r", buffering=-1):
     try:
         self.direct_fdopen(fd, mode, buffering)
     except StreamErrors, e:
         raise wrap_streamerror(self.space, e, self.w_name)