1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-27 11:34:41 +01:00

Fixed something that didnt happen before in py2

This commit is contained in:
Sammy Pfeiffer 2015-03-16 12:23:14 +01:00
parent 186c5e837c
commit 438a1c294b

View File

@ -102,11 +102,12 @@ def serialize_method(bytes_io, type_, **kwargs):
def serialize_param(bytes_io, type_, value):
print("type(value): " + str(type(value)))
if type_ == "int":
assert isinstance(value, int)
bytes_io.write(struct.pack('<i', value))
elif type_ == "long":
assert isinstance(value, int)
assert (isinstance(value, long) or isinstance(value, int)) # Py2 can be both
bytes_io.write(struct.pack('<q', value))
elif type_ in ["int128", "int256"]:
assert isinstance(value, bytes)