From 17903ebd95e5a4bde0418fd873c3fc43c770980d Mon Sep 17 00:00:00 2001
From: Piotr Maslanka <piotr.maslanka@henrietta.com.pl>
Date: Tue, 10 Jan 2017 06:58:47 +0100
Subject: [PATCH] compiler fix

---
 .../compilation/compile_definitions.py        |  5 +++-
 coolamqp/framing/definitions.py               | 26 ++++++++++++-------
 2 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/coolamqp/framing/compilation/compile_definitions.py b/coolamqp/framing/compilation/compile_definitions.py
index 4c8d5be..cdfae03 100644
--- a/coolamqp/framing/compilation/compile_definitions.py
+++ b/coolamqp/framing/compilation/compile_definitions.py
@@ -50,6 +50,9 @@ CoolAMQP is copyright (c) 2016 DMS Serwis s.c.
 #                                                         #
 # this has some use - speed :D                            #
 ###########################################################
+tl;dr - you received something and it's supposed to be a
+binary string? It's a memoryview all right.
+Only thing that isn't are field names in tables.
 """
 
 import struct, collections, warnings, logging, six
@@ -302,7 +305,7 @@ Field = collections.namedtuple('Field', ('name', 'type', 'basic_type', 'reserved
             while ord(buf[offset + pfl - 1]) & 1:
                 pfl += 2
         else:
-            while buf[offset + pfl - 1]) & 1:
+            while buf[offset + pfl - 1] & 1:
                 pfl += 2
         zpf = %s.zero_property_flags(buf[offset:offset+pfl]).tobytes()
         if zpf in %s.PARTICULAR_CLASSES:
diff --git a/coolamqp/framing/definitions.py b/coolamqp/framing/definitions.py
index 8a9e7d8..e387a50 100644
--- a/coolamqp/framing/definitions.py
+++ b/coolamqp/framing/definitions.py
@@ -10,13 +10,17 @@ AMQP is copyright (c) 2016 OASIS
 CoolAMQP is copyright (c) 2016 DMS Serwis s.c.
 
 
-###########################################
-# IMPORTANT NOTE
-# Type of field may depend on the origin of packet.
-# strings will be memoryviews if we received the packet
-# while they may be bytes if we created it
-#
-# this has some use - speed :D
+###########################################################
+# IMPORTANT NOTE                                          #
+# Type of field may depend on the origin of packet.       #
+# strings will be memoryviews if we received the packet   #
+# while they may be bytes if we created it                #
+#                                                         #
+# this has some use - speed :D                            #
+###########################################################
+tl;dr - you received something and it's supposed to be a
+binary string? It's a memoryview all right.
+Only thing that isn't are field names in tables.
 """
 
 import struct, collections, warnings, logging, six
@@ -2424,8 +2428,12 @@ class BasicContentPropertyList(AMQPContentPropertyList):
         """
         # extract property flags
         pfl = 2
-        while ord(buf[offset + pfl - 1]) & 1:
-            pfl += 2
+        if six.PY2:
+            while ord(buf[offset + pfl - 1]) & 1:
+                pfl += 2
+        else:
+            while buf[offset + pfl - 1] & 1:
+                pfl += 2
         zpf = BasicContentPropertyList.zero_property_flags(buf[offset:offset+pfl]).tobytes()
         if zpf in BasicContentPropertyList.PARTICULAR_CLASSES:
             return BasicContentPropertyList.PARTICULAR_CLASSES[zpf].from_buffer(buf, offset)
-- 
GitLab