~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/sftp.py

(gz) Bug #656170, be more aggressive about closing file handles (Martin [gz])

Show diffs side-by-side

added added

removed removed

Lines of Context:
281
281
                    buffered = buffered[buffered_offset:]
282
282
                    buffered_data = [buffered]
283
283
                    buffered_len = len(buffered)
 
284
        # now that the data stream is done, close the handle
 
285
        fp.close()
284
286
        if buffered_len:
285
287
            buffered = ''.join(buffered_data)
286
288
            del buffered_data[:]
421
423
        :param relpath: The relative path to the file
422
424
        """
423
425
        try:
424
 
            # FIXME: by returning the file directly, we don't pass this
425
 
            # through to report_activity.  We could try wrapping the object
426
 
            # before it's returned.  For readv and get_bytes it's handled in
427
 
            # the higher-level function.
428
 
            # -- mbp 20090126
429
426
            path = self._remote_path(relpath)
430
427
            f = self._get_sftp().file(path, mode='rb')
431
428
            if self._do_prefetch and (getattr(f, 'prefetch', None) is not None):