Skip to content

Commit

Permalink
Tolerate errors when cleaning up a task cancellation
Browse files Browse the repository at this point in the history
Fixes #110
  • Loading branch information
miguelgrinberg committed Jun 26, 2017
1 parent 9d7fbb9 commit a504e6b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions engineio/asyncio_socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,14 @@ async def writer():
# there is a bug (https://bugs.python.org/issue30508) in
# asyncio that causes a "Task exception never retrieved" error
# to appear when wait_task raises an exception before it gets
# cancelled. Calling wait_tas.exception() prevents the error
# from being issued.
wait_task.exception()
# cancelled. Calling wait_task.exception() prevents the error
# from being issued in Python 3.6, but causes other errors in
# other versions, so we run it with all errors suppressed and
# hope for the best.
try:
wait_task.exception()
except:
pass
break
except:
break
Expand Down

0 comments on commit a504e6b

Please sign in to comment.