mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-22 23:48:12 +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:
|
if repeated:
|
||||||
flags = 'p.FLAG_REPEATED'
|
flags = 'p.FLAG_REPEATED'
|
||||||
pytype = "list"
|
pytype = "list"
|
||||||
value = []
|
value = None
|
||||||
else:
|
else:
|
||||||
flags = '0'
|
flags = '0'
|
||||||
value = None
|
value = None
|
||||||
@ -94,7 +94,10 @@ def process_type(t, cls, msg_id, indexfile, is_upy):
|
|||||||
|
|
||||||
args.append(" %s: %s = %s," % (fieldname, pytype, value))
|
args.append(" %s: %s = %s," % (fieldname, pytype, value))
|
||||||
|
|
||||||
assigns.append(" self.%s = %s" % (fieldname, fieldname))
|
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
|
# print fieldname, number, type, repeated, comment
|
||||||
# print v.__dict__
|
# print v.__dict__
|
||||||
|
Loading…
Reference in New Issue
Block a user