Skip to content

Commit 9486f2d

Browse files
committed
Fix Button process() on Micropython
Micropython doesn't handle deep superclass constructors properly, so the _state attribute wasn't initialized.
1 parent 3cf0281 commit 9486f2d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ev3dev2/button.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def process(self, new_state=None):
130130
"""
131131
if new_state is None:
132132
new_state = set(self.buttons_pressed)
133-
old_state = self._state
133+
old_state = self._state if hasattr(self, '_state') else set()
134134
self._state = new_state
135135

136136
state_diff = new_state.symmetric_difference(old_state)

0 commit comments

Comments
 (0)