Files
openide/python/testData/debug/test_asyncio_gather_debugger.py
Egor Eliseev 2ecdf794a3 PY-57290 Debugger asyncio improvements
Patch field '_ready' from asyncio event loop for internal coroutine.
Patch `asyncio.new_event_loop()`
Add wrapper 'PyDevCoro' for internal coroutine.
Patch `asyncio.Task.__init__`, `asyncio.ensure_future` and `asyncio.call_soon`.
Add tests for `asyncio.gather` function.
Patch `asyncio.new_event_loop()`.

IJ-CR-99158

GitOrigin-RevId: 881087716a84c8ebb5331de4e2829bf38f2090e2
2023-03-22 16:10:02 +00:00

26 lines
495 B
Python

import asyncio
async def foo(y):
return y + 1
async def factorial(name, number):
f = 1
for i in range(2, number + 1):
print(f"Task {name}: Compute factorial({number}), currently i={i}...")
await asyncio.sleep(1)
f *= i
print(f"Task {name}: factorial({number}) = {f}")
return f
async def main():
L = await asyncio.gather(
factorial("A", 2),
factorial("B", 3),
factorial("C", 4),
)
print(L)
asyncio.run(main())