Skip to content

Commit

Permalink
Fixup child watcher debug log
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasf committed Sep 8, 2020
1 parent 8a81818 commit c0f4132
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions chess/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,23 +111,23 @@ def _init_watcher(self) -> asyncio.AbstractChildWatcher:

try:
os.close(os.pidfd_open(os.getpid())) # type: ignore
return asyncio.PidfdChildWatcher() # type: ignore
watcher: asyncio.AbstractChildWatcher = asyncio.PidfdChildWatcher() # type: ignore
LOGGER.debug("Using PidfdChildWatcher")
return watcher
except (AttributeError, OSError):
# Before Python 3.9 or before Linux 5.3 or the syscall is not
# permitted.
pass
else:
LOGGER.debug("Using PidfdChildWatcher")

if threading.current_thread() is threading.main_thread():
try:
return asyncio.ThreadedChildWatcher()
watcher = asyncio.ThreadedChildWatcher()
LOGGER.debug("Using ThreadedChildWatcher")
return watcher
except AttributeError:
# Before Python 3.8.
LOGGER.debug("Using SafeChildWatcher")
return asyncio.SafeChildWatcher()
else:
LOGGER.debug("Using ThreadedChildWatcher")

class PollingChildWatcher(asyncio.SafeChildWatcher):
_loop: Optional[asyncio.AbstractEventLoop]
Expand Down

0 comments on commit c0f4132

Please sign in to comment.