PROTON-1325: Python "buffer" type should map to AMQP "binary"

Add an automatic mapping from a python buffer object to the AMQP binary type.

In the other direction, AMQP "binary" maps to the python "bytes" or "str" type, as before.
diff --git a/proton-c/bindings/python/proton/__init__.py b/proton-c/bindings/python/proton/__init__.py
index 25afa44..1478d38 100644
--- a/proton-c/bindings/python/proton/__init__.py
+++ b/proton-c/bindings/python/proton/__init__.py
@@ -1840,7 +1840,7 @@
     @type b: binary
     @param b: a binary value
     """
-    self._check(pn_data_put_binary(self._data, b))
+    self._check(pn_data_put_binary(self._data, bytes(b)))
 
   def put_string(self, s):
     """
@@ -2229,6 +2229,7 @@
     list: put_sequence,
     tuple: put_sequence,
     dict: put_dict,
+    buffer: put_binary,
     Described: put_py_described,
     Array: put_py_array
     }
diff --git a/tests/python/proton_tests/codec.py b/tests/python/proton_tests/codec.py
index 9f246bf..b7bb04d 100644
--- a/tests/python/proton_tests/codec.py
+++ b/tests/python/proton_tests/codec.py
@@ -357,6 +357,15 @@
     copy = data.get_object()
     assert copy == obj, (copy, obj)
 
+  def testBuffer(self):
+    self.data.put_object(buffer("foo"))
+    data = Data()
+    data.decode(self.data.encode())
+    data.rewind()
+    assert data.next()
+    assert data.type() == Data.BINARY
+    assert data.get_object() == "foo"
+
   def testLookup(self):
     obj = {symbol("key"): str2unicode("value"),
            symbol("pi"): 3.14159,