mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-02 19:01:04 +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
|
||||
|
||||
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
|
||||
|
||||
class AsyncReader(Protocol):
|
||||
@ -278,10 +278,7 @@ async def dump_message(
|
||||
repvalue[0] = fvalue
|
||||
fvalue = repvalue
|
||||
|
||||
if isinstance(ftype, type) and issubclass(ftype, MessageType):
|
||||
ffields = ftype.get_fields()
|
||||
else:
|
||||
ffields = None
|
||||
ffields = None # type: Optional[Dict]
|
||||
|
||||
for svalue in fvalue:
|
||||
await dump_uvarint(writer, fkey)
|
||||
@ -313,6 +310,8 @@ async def dump_message(
|
||||
await writer.awrite(svalue)
|
||||
|
||||
elif issubclass(ftype, MessageType):
|
||||
if ffields is None:
|
||||
ffields = ftype.get_fields()
|
||||
await dump_uvarint(writer, count_message(svalue, ffields))
|
||||
await dump_message(writer, svalue, ffields)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user