Skip to content

Commit

Permalink
Argument to struct.unpack must be unicode on Python <=2.7.6
Browse files Browse the repository at this point in the history
  • Loading branch information
ask committed Jul 28, 2016
1 parent 1a06156 commit 9167f65
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion amqp/exceptions.py
Expand Up @@ -260,5 +260,5 @@ def error_for_code(code, text, method, default):


for _method_id, _method_name in list(METHOD_NAME_MAP.items()):
METHOD_NAME_MAP[unpack(str('>I'), pack(str('>HH'), *_method_id))[0]] = \
METHOD_NAME_MAP[unpack(u'>I', pack(u'>HH', *_method_id))[0]] = \
_method_name
2 changes: 1 addition & 1 deletion amqp/method_framing.py
Expand Up @@ -51,7 +51,7 @@ def on_frame(frame):
frame_type, expected_types[channel]),
)
elif frame_type == 1:
method_sig = unpack_from('>HH', buf, 0)
method_sig = unpack_from(u'>HH', buf, 0)

if method_sig in content_methods:
# Save what we've got so far and wait for the content-header
Expand Down
2 changes: 1 addition & 1 deletion amqp/transport.py
Expand Up @@ -220,7 +220,7 @@ def read_frame(self, unpack=unpack):
try:
frame_header = read(7, True)
read_frame_buffer += frame_header
frame_type, channel, size = unpack('>BHI', frame_header)
frame_type, channel, size = unpack(u'>BHI', frame_header)
# >I is an unsigned int, but the argument to sock.recv is signed,
# so we know the size can be at most 2 * SIGNED_INT_MAX
if size > SIGNED_INT_MAX:
Expand Down

0 comments on commit 9167f65

Please sign in to comment.