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 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:
|
||||
|
Loading…
Reference in New Issue
Block a user