Add 6.9 theory

This commit is contained in:
pro100ton 2024-11-17 23:18:06 +03:00
parent 4b3562ed50
commit cc07a631f1

View file

@ -0,0 +1,23 @@
import asyncio
async def cancel_test():
try:
await asyncio.sleep(5)
except asyncio.CancelledError:
print("Printing after cancel")
finally:
return 5
async def main():
task = asyncio.create_task(cancel_test())
await asyncio.sleep(0.1)
print(task.cancelling())
await asyncio.sleep(0.1)
print(task.cancelled())
print(task.result())
return task
asyncio.run(main())