From 01514e80c9a150f0506bd6c8c43590ca05f8598f Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 12 Aug 2022 17:03:38 +1000 Subject: [PATCH] extmod/uasyncio: Rename internal _flag to state, to save a qstr. Saves about 16 bytes of flash when uasyncio is frozen in. Signed-off-by: Damien George --- extmod/uasyncio/event.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/extmod/uasyncio/event.py b/extmod/uasyncio/event.py index 654ccefa98..3b5e79d8f2 100644 --- a/extmod/uasyncio/event.py +++ b/extmod/uasyncio/event.py @@ -42,23 +42,23 @@ try: class ThreadSafeFlag(uio.IOBase): def __init__(self): - self._flag = 0 + self.state = 0 def ioctl(self, req, flags): if req == 3: # MP_STREAM_POLL - return self._flag * flags + return self.state * flags return None def set(self): - self._flag = 1 + self.state = 1 def clear(self): - self._flag = 0 + self.state = 0 async def wait(self): - if not self._flag: + if not self.state: yield core._io_queue.queue_read(self) - self._flag = 0 + self.state = 0 except ImportError: pass