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:
parent
2880be1db6
commit
9c34491e20
@ -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.
|
||||||
|
Loading…
Reference in New Issue
Block a user