mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-16 04:35:24 +00:00
Fix vectors deserialization
This commit is contained in:
parent
ecf56abe77
commit
f7d1e581ed
@ -19,6 +19,7 @@
|
|||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from typing import cast, Union, Any
|
from typing import cast, Union, Any
|
||||||
|
|
||||||
|
from .bool import BoolFalse, BoolTrue, Bool
|
||||||
from .int import Int, Long
|
from .int import Int, Long
|
||||||
from ..list import List
|
from ..list import List
|
||||||
from ..tl_object import TLObject
|
from ..tl_object import TLObject
|
||||||
@ -32,7 +33,17 @@ class Vector(bytes, TLObject):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def read_bare(b: BytesIO, size: int) -> Union[int, Any]:
|
def read_bare(b: BytesIO, size: int) -> Union[int, Any]:
|
||||||
if size == 4:
|
if size == 4:
|
||||||
return Int.read(b)
|
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:
|
if size == 8:
|
||||||
return Long.read(b)
|
return Long.read(b)
|
||||||
|
Loading…
Reference in New Issue
Block a user