mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2025-12-29 20:14:51 +00:00
DeSerializing Bug Fixes
Git-Origin-Commit-Id: c4c275ab Git-Origin-Commit-Id: dd3f2e51 Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
parent
73922b95a7
commit
b1358c334d
1 changed files with 17 additions and 1 deletions
|
|
@ -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,7 +33,22 @@ class Vector(bytes, TLObject):
|
|||
@staticmethod
|
||||
def read_bare(b: BytesIO, size: int) -> Union[int, Any]:
|
||||
if size == 4:
|
||||
return Int.read(b)
|
||||
# cek
|
||||
e = int.from_bytes(
|
||||
b.read(4),
|
||||
"little"
|
||||
)
|
||||
# bak
|
||||
b.seek(-4, 1)
|
||||
# cond
|
||||
if e in [
|
||||
BoolFalse.ID,
|
||||
BoolTrue.ID,
|
||||
]:
|
||||
return Bool.read(b)
|
||||
# not
|
||||
else:
|
||||
return Int.read(b)
|
||||
|
||||
if size == 8:
|
||||
return Long.read(b)
|
||||
|
|
|
|||
Loading…
Reference in a new issue