summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJim Mussared <jim.mussared@gmail.com>2023-09-14 14:07:04 +1000
committerDamien George <damien@micropython.org>2023-09-29 17:58:40 +1000
commitcfe6a11e39725f42ac3fffac138d2de1587fe756 (patch)
treea2d6d2ead33be2cd376bed57ab3cebcd0cc86619
parentc854d0e3e1a05c06fadf997963932f2da5477a39 (diff)
downloadmicropython-cfe6a11e39725f42ac3fffac138d2de1587fe756.tar.gz
micropython-cfe6a11e39725f42ac3fffac138d2de1587fe756.zip
extmod/asyncio/event.py: Fix ThreadSafeFlag.ioctl return.
iobase_ioctl expects that an ioctl method must return an integer, and will raise otherwise. This was tripping up aioble on Unix, where the new hybrid modselect.c implementation will attempt to extract a file descriptor from the pollable via ioctl(MP_STREAM_GET_FILENO). However, ThreadSafeFlag's ioctl only supported MP_STREAM_POLL, and returned None otherwise. This makes it return `-1` (to match tests/extmod/select_poll_custom.py). It should probably be `-22` (corresponding to MP_EINVAL), but the value is never checked, and MP_EINVAL can be a different value on different ports. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
-rw-r--r--extmod/asyncio/event.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/extmod/asyncio/event.py b/extmod/asyncio/event.py
index e0b41f7324..f11bb14e58 100644
--- a/extmod/asyncio/event.py
+++ b/extmod/asyncio/event.py
@@ -49,7 +49,7 @@ try:
def ioctl(self, req, flags):
if req == 3: # MP_STREAM_POLL
return self.state * flags
- return None
+ return -1 # Other requests are unsupported
def set(self):
self.state = 1