Translating...
This commit is contained in:
parent
ddd92f5b30
commit
8d6632036c
4
TL.py
4
TL.py
@ -117,7 +117,6 @@ def deserialize(bytes_io, type_=None, subtype=None):
|
|||||||
"""
|
"""
|
||||||
:type bytes_io: io.BytesIO object
|
:type bytes_io: io.BytesIO object
|
||||||
"""
|
"""
|
||||||
print type_
|
|
||||||
assert isinstance(bytes_io, io.BytesIO)
|
assert isinstance(bytes_io, io.BytesIO)
|
||||||
# Built-in bare types
|
# Built-in bare types
|
||||||
if type_ == 'int': x = struct.unpack('<i', bytes_io.read(4))[0]
|
if type_ == 'int': x = struct.unpack('<i', bytes_io.read(4))[0]
|
||||||
@ -137,6 +136,7 @@ def deserialize(bytes_io, type_=None, subtype=None):
|
|||||||
else:
|
else:
|
||||||
# We have a short string
|
# We have a short string
|
||||||
x = bytes_io.read(l)
|
x = bytes_io.read(l)
|
||||||
|
print(-(l+1))
|
||||||
bytes_io.read(-(l+1) % 4) # skip padding bytes
|
bytes_io.read(-(l+1) % 4) # skip padding bytes
|
||||||
assert isinstance(x, bytes)
|
assert isinstance(x, bytes)
|
||||||
elif type_ == 'vector':
|
elif type_ == 'vector':
|
||||||
@ -151,6 +151,8 @@ def deserialize(bytes_io, type_=None, subtype=None):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
# Boxed types
|
# Boxed types
|
||||||
i = struct.unpack('<i', bytes_io.read(4))[0] # read type ID
|
i = struct.unpack('<i', bytes_io.read(4))[0] # read type ID
|
||||||
|
print type_
|
||||||
|
print i
|
||||||
try:
|
try:
|
||||||
tl_elem = tl.constructor_id[i]
|
tl_elem = tl.constructor_id[i]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user