Skip to content

Commit

Permalink
Add check for bit length used by frame int value to write long-long-int
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob Hagstedt committed Nov 28, 2018
1 parent ead626e commit 2e0c46a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions aioamqp/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,12 @@ def write_value(self, value):
self.payload.write(b'F')
self.write_table(value)
elif isinstance(value, int):
self.payload.write(b'I')
self.write_long(value)
if value.bit_length() >= 32:
self.payload.write(b'L')
self.write_long_long(value)
else:
self.payload.write(b'I')
self.write_long(value)
elif isinstance(value, float):
self.payload.write(b'd')
self.write_float(value)
Expand Down

0 comments on commit 2e0c46a

Please sign in to comment.