Skip to content

Commit

Permalink
fix: A bogus typecheck error with asyncio.PidfdChildWatcher
Browse files Browse the repository at this point in the history
  • Loading branch information
achimnol committed Apr 25, 2022
1 parent 20d90b6 commit 46152be
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/aiotools/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,9 @@ def helper(*args, **kwargs):
def setup_child_watcher(loop: asyncio.AbstractEventLoop) -> None:
try:
asyncio.get_child_watcher()
if hasattr(asyncio, 'PidfdChildWatcher'):
watcher = asyncio.PidfdChildWatcher()
watcher_cls = getattr(asyncio, 'PidfdChildWatcher', None)
if watcher_cls is not None:
watcher = watcher_cls()
asyncio.set_child_watcher(watcher)
watcher.attach_loop(loop)
except NotImplementedError:
Expand Down

0 comments on commit 46152be

Please sign in to comment.