mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-17 21:22:10 +00:00
fix(python/protobuf): correctly dump messages with missing required fields
This commit is contained in:
parent
bbf286e050
commit
e0754d1609
1
python/.changelog.d/2135.fixed
Normal file
1
python/.changelog.d/2135.fixed
Normal file
@ -0,0 +1 @@
|
||||
Fixed error when printing protobuf message with a missing required field.
|
@ -550,9 +550,13 @@ def format_message(
|
||||
|
||||
return repr(value)
|
||||
|
||||
return "{name} ({size} bytes) {content}".format(
|
||||
try:
|
||||
byte_size = str(pb.ByteSize()) + " bytes"
|
||||
except Exception:
|
||||
byte_size = "encoding failed"
|
||||
return "{name} ({size}) {content}".format(
|
||||
name=pb.__class__.__name__,
|
||||
size=pb.ByteSize(),
|
||||
size=byte_size,
|
||||
content=pformat("", pb.__dict__, indent),
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user