mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2026-01-09 08:14:50 +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 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,22 @@ 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)
|
# 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:
|
if size == 8:
|
||||||
return Long.read(b)
|
return Long.read(b)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue