Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Commit

Permalink
Fix crash from float timeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
abhinav committed Apr 7, 2016
1 parent 721789a commit 12adfdb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGES.rst
Expand Up @@ -4,7 +4,7 @@ Changes by Version
0.22.3 (unreleased)
-------------------

- Nothing changed yet.
- Fixed a bug where type mismatch for timeouts could cause a crash.


0.22.2 (2016-04-06)
Expand Down
3 changes: 2 additions & 1 deletion tchannel/rw.py
Expand Up @@ -363,7 +363,8 @@ def read(self, stream):
return struct.unpack(self._format, self.take(stream, self._width))[0]

def write(self, num, stream):
stream.write(struct.pack(self._format, num))
# Cast to int just in case the value is still a float
stream.write(struct.pack(self._format, int(num)))
return stream

def width(self):
Expand Down

0 comments on commit 12adfdb

Please sign in to comment.