tags 750517 +patch
thanks

The attached patch fixes this bug by re-adding support for passing in
buffer() objects. I have also submitted it upstream, but it'd be great
if this could land in unstable soon since this regression is breaking
all builds of bzr.
diff --git a/debian/changelog b/debian/changelog
index bc5d4b8..5c6854e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+paramiko (1.14.0-3) UNRELEASED; urgency=medium
+
+  * Add patch 01_fix_buffer_argument, allowing buffer() objects to be
+    passed in where bytestrings are supported. Closes: #750517
+
+ -- Jelmer Vernooij <[email protected]>  Sat, 05 Jul 2014 23:57:15 +0200
+
 paramiko (1.14.0-2) unstable; urgency=low
 
   * Add extend-diff-ignore to debian/source/options.
diff --git a/debian/patches/01_fix_buffer_argument b/debian/patches/01_fix_buffer_argument
new file mode 100644
index 0000000..7a79d3e
--- /dev/null
+++ b/debian/patches/01_fix_buffer_argument
@@ -0,0 +1,47 @@
+Author: Jelmer Vernooij <[email protected]>
+Description: Support passing in "buffer" objects again where bytestrings are expected.
+Debian-Bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=750517
+Status: merge proposal created for upstream
+Bug: https://github.com/paramiko/paramiko/issues/343
+
+diff --git a/paramiko/py3compat.py b/paramiko/py3compat.py
+index 8842b98..57c096b 100644
+--- a/paramiko/py3compat.py
++++ b/paramiko/py3compat.py
+@@ -39,6 +39,8 @@ if PY2:
+             return s
+         elif isinstance(s, unicode):
+             return s.encode(encoding)
++        elif isinstance(s, buffer):
++            return s
+         else:
+             raise TypeError("Expected unicode or bytes, got %r" % s)
+ 
+@@ -49,6 +51,8 @@ if PY2:
+             return s.decode(encoding)
+         elif isinstance(s, unicode):
+             return s
++        elif isinstance(s, buffer):
++            return s.decode(encoding)
+         else:
+             raise TypeError("Expected unicode or bytes, got %r" % s)
+ 
+diff --git a/tests/test_file.py b/tests/test_file.py
+index c6edd7a..cd9cd54 100755
+--- a/tests/test_file.py
++++ b/tests/test_file.py
+@@ -151,6 +151,14 @@ class BufferedFileTest (unittest.TestCase):
+                             b'need to close them again.\n')
+         f.close()
+ 
++    def test_8_buffering(self):
++        """
++        verify that buffered objects can be written
++        """
++        f = LoopbackFile('r+', 16)
++        f.write(buffer(b'Too small.'))
++        f.close()
++
+ if __name__ == '__main__':
+     from unittest import main
+     main()
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..b8b8fc3
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+01_fix_buffer_argument

Attachment: signature.asc
Description: Digital signature



Reply via email to