diff options
author | Robey Pointer <robey@lag.net> | 2006-05-01 17:27:09 -0700 |
---|---|---|
committer | Robey Pointer <robey@lag.net> | 2006-05-01 17:27:09 -0700 |
commit | 2067e9a1368376f5ac7955874362679751562eca (patch) | |
tree | c06e5768590ece03047caff51ec84115a1895050 | |
parent | 57bc6728af8f8cb2bf2a0250d1261df6f916f8d4 (diff) |
[project @ robey@lag.net-20060502002709-617a268779f7ca6b]
readv should just yield results as it gets them (suggestion from robertc)
-rw-r--r-- | paramiko/sftp_file.py | 4 | ||||
-rw-r--r-- | tests/test_sftp_big.py | 2 |
2 files changed, 2 insertions, 4 deletions
diff --git a/paramiko/sftp_file.py b/paramiko/sftp_file.py index 17f999e7..28879861 100644 --- a/paramiko/sftp_file.py +++ b/paramiko/sftp_file.py @@ -388,11 +388,9 @@ class SFTPFile (BufferedFile): ordered_chunks.sort(lambda x, y: cmp(x[0], y[0])) self._start_prefetch(ordered_chunks) # now we can just devolve to a bunch of read()s :) - out = [] for x in chunks: self.seek(x[0]) - out.append(self.read(x[1])) - return out + yield self.read(x[1]) ### internals... diff --git a/tests/test_sftp_big.py b/tests/test_sftp_big.py index aefe3ef3..94edab02 100644 --- a/tests/test_sftp_big.py +++ b/tests/test_sftp_big.py @@ -232,7 +232,7 @@ class BigSFTPTest (unittest.TestCase): for i in xrange(len(readv_list)): offset = readv_list[i][0] n_offset = offset % 1024 - self.assertEqual(ret[i], k2blob[n_offset:n_offset + chunk]) + self.assertEqual(ret.next(), k2blob[n_offset:n_offset + chunk]) f.close() end = time.time() sys.stderr.write('%ds ' % round(end - start)) |