Skip to content

Commit deba567

Browse files
author
sezanzeb
authored
Update eventio_async.py
fixes lutris/lutris#3250 _do_when_readable is only used for e.g. async_read, but InputDevice may not use that and use read instead. So _do_when_readable is never called and no event loop is needed.
1 parent 00c0fa7 commit deba567

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

‎evdev/eventio_async.py‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,13 @@ def async_read_loop(self):
5151
return ReadIterator(self)
5252

5353
def close(self):
54-
loop = asyncio.get_event_loop()
55-
loop.remove_reader(self.fileno())
54+
try:
55+
loop = asyncio.get_event_loop()
56+
loop.remove_reader(self.fileno())
57+
except RuntimeError:
58+
# no event loop present, so there is nothing to
59+
# remove the header from. ignore
60+
pass
5661

5762

5863
class ReadIterator(object):

0 commit comments

Comments
 (0)