mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-13 08:02:01 +00:00
core/protobuf: fix 5b6fa113
This commit is contained in:
parent
e897f7cf7f
commit
6835748bbf
@ -6,7 +6,7 @@ bytes, string, embedded message and repeated fields.
|
|||||||
from micropython import const
|
from micropython import const
|
||||||
|
|
||||||
if False:
|
if False:
|
||||||
from typing import Any, Dict, Iterable, List, Type, TypeVar, Union
|
from typing import Any, Dict, Iterable, List, Optional, Type, TypeVar, Union
|
||||||
from typing_extensions import Protocol
|
from typing_extensions import Protocol
|
||||||
|
|
||||||
class AsyncReader(Protocol):
|
class AsyncReader(Protocol):
|
||||||
@ -278,10 +278,7 @@ async def dump_message(
|
|||||||
repvalue[0] = fvalue
|
repvalue[0] = fvalue
|
||||||
fvalue = repvalue
|
fvalue = repvalue
|
||||||
|
|
||||||
if isinstance(ftype, type) and issubclass(ftype, MessageType):
|
ffields = None # type: Optional[Dict]
|
||||||
ffields = ftype.get_fields()
|
|
||||||
else:
|
|
||||||
ffields = None
|
|
||||||
|
|
||||||
for svalue in fvalue:
|
for svalue in fvalue:
|
||||||
await dump_uvarint(writer, fkey)
|
await dump_uvarint(writer, fkey)
|
||||||
@ -313,6 +310,8 @@ async def dump_message(
|
|||||||
await writer.awrite(svalue)
|
await writer.awrite(svalue)
|
||||||
|
|
||||||
elif issubclass(ftype, MessageType):
|
elif issubclass(ftype, MessageType):
|
||||||
|
if ffields is None:
|
||||||
|
ffields = ftype.get_fields()
|
||||||
await dump_uvarint(writer, count_message(svalue, ffields))
|
await dump_uvarint(writer, count_message(svalue, ffields))
|
||||||
await dump_message(writer, svalue, ffields)
|
await dump_message(writer, svalue, ffields)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user