Bar Harel <bzvi7...@gmail.com> added the comment:
It relinquishes control for exactly one event loop cycle. You'll see that it takes two or three cycles and then gets cancelled correctly. The reason being is that recovery from your `await asyncio.sleep(1)` takes two or three cycles. (Under the hood, a few `asyncio.call_soon()` are called in a chain and only 1 is executed each cycle). This is not a bug, but rather intended behavior. You should probably use `asyncio.to_thread()` or preferably run cpu-intensive code on a different process. @triage Please close as not-a-bug. ---------- nosy: +bar.harel _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue40800> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com