self.__dict__ does not work properly in uP, workaround

pull/25/head
Jan Pochyla 8 years ago committed by Pavol Rusnak
parent 2880be1db6
commit 9c34491e20
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

@ -200,7 +200,10 @@ class Message:
def __init__(self, message_type, **fields):
# Initializes a new instance of the specified 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):
# Dumps the message into a write-like object.

Loading…
Cancel
Save