This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author bar.harel
Recipients Davy Durham, asvetlov, bar.harel, yselivanov
Date 2020-12-01.17:47:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1606844832.05.0.110147128627.issue40800@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2020-12-01 17:47:12bar.harelsetrecipients: + bar.harel, asvetlov, yselivanov, Davy Durham
2020-12-01 17:47:12bar.harelsetmessageid: <1606844832.05.0.110147128627.issue40800@roundup.psfhosted.org>
2020-12-01 17:47:12bar.harellinkissue40800 messages
2020-12-01 17:47:11bar.harelcreate