summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--paramiko/sftp_file.py8
-rw-r--r--sites/www/changelog.rst2
2 files changed, 8 insertions, 2 deletions
diff --git a/paramiko/sftp_file.py b/paramiko/sftp_file.py
index fe0f8c79..425a469a 100644
--- a/paramiko/sftp_file.py
+++ b/paramiko/sftp_file.py
@@ -378,8 +378,8 @@ class SFTPFile (BufferedFile):
.. versionadded:: 1.5
"""
self.pipelined = pipelined
-
- def prefetch(self, file_size):
+
+ def prefetch(self, file_size=None):
"""
Pre-fetch the remaining contents of this file in anticipation of future
`.read` calls. If reading the entire file, pre-fetching can
@@ -393,6 +393,10 @@ class SFTPFile (BufferedFile):
.. versionadded:: 1.5.1
"""
+
+ if file_size is None:
+ file_size = self.stat().st_size;
+
# queue up async reads for the rest of the file
chunks = []
n = self._realpos
diff --git a/sites/www/changelog.rst b/sites/www/changelog.rst
index eb89a4ee..dcad7fe6 100644
--- a/sites/www/changelog.rst
+++ b/sites/www/changelog.rst
@@ -2,6 +2,8 @@
Changelog
=========
+* :bug:`676` paramiko.sftp_file.prefetch is now backwards compatible with
+ previous versions of paramiko (1.15 to 1.5)
* :bug:`577` (via :issue:`578`; should also fix :issue:`718`, :issue:`560`) Fix
stalled/hung SFTP downloads by cleaning up some threading lock issues. Thanks
to Stephen C. Pope for the patch.