Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions evdev/eventio_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ def __next__(self):
def __aiter__(self):
return self

@asyncio.coroutine
def __anext__(self):
async def __anext__(self):

@jonasBoss jonasBoss Jul 17, 2022

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

according to the python docs __anext__ should return a Awaitable which this function already does. So there is no need to use the async keyword. async def would wrap the whole function again inside a awaitable making it necessary to await this function twice.

Suggested change
async def __anext__(self):
def __anext__(self):

As for the @asyncio.coroutine: I think this was never needed as it was meant for generator-based coroutines which this function is not.

I did some quick tests with python3.8 and 3.10. This seems to work fine.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi. I think this is the correct solution indeed. Will release a new version asap. Thanks!

future = asyncio.Future()
try:
# Read from the previous batch of events.
Expand Down