Bug report
Bug description:
pythonimport asyncio
async def main():
async def worker():
await asyncio.sleep(10)
task = asyncio.create_task(worker())
await asyncio.sleep(0) # let task start and reach the await
task.cancel(msg='timed out waiting for GPU')
try:
await task
except asyncio.CancelledError:
print(task._cancel_message) # prints None, should print the msg
asyncio.run(main())
When Task.cancel(msg=...) is called while the task is waiting on another future, the message is silently discarded. Two causes:
cancel() fast path returns True without storing msg in _cancel_message
__step_run_and_handle_result() calls future_cancel(..., NULL) dropping _cancel_message
CPython versions tested on: main
Operating systems: Windows, Linux
CPython versions tested on:
CPython main branch
Operating systems tested on:
Windows
Linked PRs
Bug report
Bug description:
pythonimport asyncio
async def main():
async def worker():
await asyncio.sleep(10)
asyncio.run(main())
When Task.cancel(msg=...) is called while the task is waiting on another future, the message is silently discarded. Two causes:
cancel() fast path returns True without storing msg in _cancel_message
__step_run_and_handle_result() calls future_cancel(..., NULL) dropping _cancel_message
CPython versions tested on: main
Operating systems: Windows, Linux
CPython versions tested on:
CPython main branch
Operating systems tested on:
Windows
Linked PRs