python 3.11 fixes

This commit is contained in:
Maxim Devaev
2023-05-04 12:37:05 +03:00
parent b5d6731497
commit b5353e63cd
8 changed files with 37 additions and 22 deletions

View File

@@ -215,7 +215,10 @@ class Inotify:
async def get_event(self, timeout: float) -> (InotifyEvent | None):
assert timeout > 0
try:
return (await asyncio.wait_for(self.__events_queue.get(), timeout=timeout))
return (await asyncio.wait_for(
asyncio.ensure_future(self.__events_queue.get()),
timeout=timeout,
))
except asyncio.TimeoutError:
return None