1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-23 14:58:09 +00:00

self.__dict__ does not work properly in uP, workaround

This commit is contained in:
Jan Pochyla 2016-06-01 14:31:49 +02:00 committed by Pavol Rusnak
parent 2880be1db6
commit 9c34491e20
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

View File

@ -200,7 +200,10 @@ class Message:
def __init__(self, message_type, **fields): def __init__(self, message_type, **fields):
# Initializes a new instance of the specified message type. # Initializes a new instance of the specified message type.
self.message_type = message_type self.message_type = message_type
self.__dict__.update(fields) # In micropython, we cannot use self.__dict__.update(fields),
# iterate fields and assign them directly.
for key in fields:
setattr(self, key, fields[key])
def dump(self, fp): def dump(self, fp):
# Dumps the message into a write-like object. # Dumps the message into a write-like object.