From 3fce8abf68f386d18f2fad9f086e0d436af57b3a Mon Sep 17 00:00:00 2001 From: Antoine Brenner Date: Wed, 16 Apr 2014 21:58:03 +0200 Subject: BufferedFile.read() now returns byte strings instead of text strings It is the right thing to do since we have no idea what encoding the file is in, or even if the file is text data. BufferedFile.readline() is unchanged and returns text strings assuming the file is utf-8 encoded. This should fix the following issue: http://comments.gmane.org/gmane.comp.sysutils.backup.obnam/252 Antoine Brenner Conflicts: sites/www/changelog.rst --- sites/www/changelog.rst | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'sites/www') diff --git a/sites/www/changelog.rst b/sites/www/changelog.rst index 21ba6e12..67c4f827 100644 --- a/sites/www/changelog.rst +++ b/sites/www/changelog.rst @@ -2,6 +2,13 @@ Changelog ========= +* :bug: BufferedFile.read() now returns byte strings instead of text strings + It is the right thing to do since we have no idea what encoding the file + is in, or even if the file is text data. BufferedFile.readline() is + unchanged and returns text strings assuming the file is utf-8 encoded. + This should fix the following issue: + http://comments.gmane.org/gmane.comp.sysutils.backup.obnam/252 + Thanks Antoine Brenner * :bug:`-` Added self.args for exception classes. Used for unpickling. Related to (`Fabric #986 `_, `Fabric #714 `_). Thanks to Alex -- cgit v1.2.3 From 5636381591aa26a9f31efab450b6bfdd6659cbb3 Mon Sep 17 00:00:00 2001 From: Jeff Forcier Date: Thu, 24 Apr 2014 09:33:38 -0700 Subject: Reword docs/changelog re #315 --- paramiko/file.py | 19 +++++++++---------- sites/www/changelog.rst | 20 +++++++++++++------- 2 files changed, 22 insertions(+), 17 deletions(-) (limited to 'sites/www') diff --git a/paramiko/file.py b/paramiko/file.py index 725ca5f6..70243e40 100644 --- a/paramiko/file.py +++ b/paramiko/file.py @@ -124,15 +124,14 @@ class BufferedFile (object): file first). If the ``size`` argument is negative or omitted, read all the remaining data in the file. - `'b' mode flag is ignored (self.FLAG_BINARY in self._flags), because - SSH treats all files as binary, since we have no idea what encoding - the file is in, or even if the file is text data. - + ``'b'`` mode flag is ignored (``self.FLAG_BINARY`` in ``self._flags``), + because SSH treats all files as binary, since we have no idea what + encoding the file is in, or even if the file is text data. :param int size: maximum number of bytes to read :return: - data read from the file (as bytes ), or an empty string - if EOF was encountered immediately + data read from the file (as bytes), or an empty string if EOF was + encountered immediately """ if self._closed: raise IOError('File is closed') @@ -193,10 +192,10 @@ class BufferedFile (object): :return: next line of the file, or an empty string if the end of the file has been reached. - If the file was opened in binary 'b' mode: bytes are returned - Else: the encoding of the file is assumed to be utf-8 (default - encoding used by paramiko.py3compat.u) and character strings - (`str`) are returned + + If the file was opened in binary (``'b'``) mode: bytes are returned + Else: the encoding of the file is assumed to be UTF-8 and character + strings (`str`) are returned """ # it's almost silly how complex this function is. if self._closed: diff --git a/sites/www/changelog.rst b/sites/www/changelog.rst index 67c4f827..8a4b0f56 100644 --- a/sites/www/changelog.rst +++ b/sites/www/changelog.rst @@ -2,13 +2,19 @@ Changelog ========= -* :bug: BufferedFile.read() now returns byte strings instead of text strings - It is the right thing to do since we have no idea what encoding the file - is in, or even if the file is text data. BufferedFile.readline() is - unchanged and returns text strings assuming the file is utf-8 encoded. - This should fix the following issue: - http://comments.gmane.org/gmane.comp.sysutils.backup.obnam/252 - Thanks Antoine Brenner +* :bug:`-` `paramiko.file.BufferedFile.read` incorrectly returned text strings + after the Python 3 migration, despite bytes being more appropriate for file + contents (which may be binary or of an unknown encoding.) This has been + addressed. + + .. note:: + `paramiko.file.BufferedFile.readline` continues to return strings, not + bytes, as "lines" only make sense for textual data. It assumes UTF-8 by + default. + + This should fix `this issue raised on the Obnam mailing list + `_. Thanks + to Antoine Brenner for the patch. * :bug:`-` Added self.args for exception classes. Used for unpickling. Related to (`Fabric #986 `_, `Fabric #714 `_). Thanks to Alex -- cgit v1.2.3 From a759a8e8df0127e624d69f0e2c02704a95e0cc0c Mon Sep 17 00:00:00 2001 From: Jeff Forcier Date: Thu, 24 Apr 2014 09:33:48 -0700 Subject: Fix incorrect monospacing --- sites/www/installing.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sites/www') diff --git a/sites/www/installing.rst b/sites/www/installing.rst index 3587949f..0ca9b156 100644 --- a/sites/www/installing.rst +++ b/sites/www/installing.rst @@ -18,8 +18,8 @@ We currently support **Python 2.5/2.6/2.7**, with support for Python 3 coming soon. Users on Python 2.4 or older are urged to upgrade. Paramiko *may* work on Python 2.4 still, but there is no longer any support guarantee. -Paramiko has two dependencies: the pure-Python ECDSA module `ecdsa`, and the -PyCrypto C extension. `ecdsa` is easily installable from wherever you +Paramiko has two dependencies: the pure-Python ECDSA module ``ecdsa``, and the +PyCrypto C extension. ``ecdsa`` is easily installable from wherever you obtained Paramiko's package; PyCrypto may require more work. Read on for details. -- cgit v1.2.3