Bug report
A clear and concise description of the bug
The run_in_executor function in asyncio does not stop the thread after task cancellation.
Steps to Reproduce
import asyncio
import time
def runner():
while True:
print('Running.')
time.sleep(1)
async def test():
task = asyncio.get_event_loop().run_in_executor(None, runner)
task.cancel()
await task
asyncio.get_event_loop().run_until_complete(test())
Expected Behavior
The run_in_executor function should stop the thread and terminate the task when it is canceled.
Actual Behavior
The run_in_executor function does not stop the thread and the task continues to run even after it is canceled.
Your environment
- CPython versions tested on: python3.11
- Operating system and architecture: macOS M1
Bug report
A clear and concise description of the bug
The
run_in_executorfunction in asyncio does not stop the thread after task cancellation.Steps to Reproduce
Expected Behavior
The
run_in_executorfunction should stop the thread and terminate the task when it is canceled.Actual Behavior
The
run_in_executorfunction does not stop the thread and the task continues to run even after it is canceled.Your environment