1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-26 17:38:39 +00:00

tools/pb2py: fix default list value

This commit is contained in:
Jan Pochyla 2018-02-27 00:08:37 +01:00
parent a4477b8bef
commit 048e0706b3

View File

@ -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,6 +94,9 @@ 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))
if repeated:
assigns.append(" self.%s = [] if %s is None else %s" % (fieldname, fieldname, fieldname))
else:
assigns.append(" self.%s = %s" % (fieldname, fieldname)) assigns.append(" self.%s = %s" % (fieldname, fieldname))
# print fieldname, number, type, repeated, comment # print fieldname, number, type, repeated, comment