Skip to content

Commit

Permalink
Use Python 3.12-specific way of fetching all tasks of all loops
Browse files Browse the repository at this point in the history
Signed-off-by: Sergey Vasilyev <[email protected]>
  • Loading branch information
nolar committed Oct 9, 2023
1 parent 03b4885 commit b626a75
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,10 @@ def _get_all_tasks() -> Set[asyncio.Task]:
i = 0
while True:
try:
tasks = list(asyncio.tasks._all_tasks)
if sys.version_info >= (3, 12):
tasks = asyncio.tasks._eager_tasks | set(asyncio.tasks._scheduled_tasks)
else:
tasks = list(asyncio.tasks._all_tasks)
except RuntimeError:
i += 1
if i >= 1000:
Expand Down

0 comments on commit b626a75

Please sign in to comment.