use floor division

This commit is contained in:
tim watts 2016-01-05 22:37:22 +00:00
parent 65a0156412
commit eece2ae7a5
3 changed files with 3 additions and 5 deletions

View File

@ -56,7 +56,7 @@ class CounterAppContext():
return "", 0
h = encode_big_endian(self.txCount, 8)
h.reverse()
return str(h), 0
return h.decode(), 0
def commit(self):
self.commitCount += 1

View File

@ -165,9 +165,7 @@ class TMSPServer():
self.handle_conn_closed(r)
return
except Exception as e:
import sys
print(sys.exc_info()[0])
print("error reading from connection", str(e))
logger.exception("error reading from connection")
self.handle_conn_closed(r)
return

View File

@ -29,7 +29,7 @@ def uvarint_size(i):
def encode_big_endian(i, size):
if size == 0:
return bytearray()
return encode_big_endian(i / 256, size - 1) + bytearray([i % 256])
return encode_big_endian(i // 256, size - 1) + bytearray([i % 256])
def decode_big_endian(reader, size):