mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-22 15:38:11 +00:00
tools/pb2py: fix default list value
This commit is contained in:
parent
a4477b8bef
commit
048e0706b3
@ -84,7 +84,7 @@ def process_type(t, cls, msg_id, indexfile, is_upy):
|
||||
if repeated:
|
||||
flags = 'p.FLAG_REPEATED'
|
||||
pytype = "list"
|
||||
value = []
|
||||
value = None
|
||||
else:
|
||||
flags = '0'
|
||||
value = None
|
||||
@ -94,6 +94,9 @@ def process_type(t, cls, msg_id, indexfile, is_upy):
|
||||
|
||||
args.append(" %s: %s = %s," % (fieldname, pytype, value))
|
||||
|
||||
if repeated:
|
||||
assigns.append(" self.%s = [] if %s is None else %s" % (fieldname, fieldname, fieldname))
|
||||
else:
|
||||
assigns.append(" self.%s = %s" % (fieldname, fieldname))
|
||||
|
||||
# print fieldname, number, type, repeated, comment
|
||||
|
Loading…
Reference in New Issue
Block a user