Fix vectors deserialization

This commit is contained in:
AmarnathCJD 2024-01-19 18:03:02 +03:00 committed by KurimuzonAkuma
parent ecf56abe77
commit f7d1e581ed

View File

@ -19,6 +19,7 @@
from io import BytesIO
from typing import cast, Union, Any
from .bool import BoolFalse, BoolTrue, Bool
from .int import Int, Long
from ..list import List
from ..tl_object import TLObject
@ -32,6 +33,16 @@ class Vector(bytes, TLObject):
@staticmethod
def read_bare(b: BytesIO, size: int) -> Union[int, Any]:
if size == 4:
e = int.from_bytes(
b.read(4),
"little"
)
b.seek(-4, 1)
if e in (BoolFalse.ID, BoolTrue.ID):
return Bool.read(b)
else:
return Int.read(b)
if size == 8: