Skip to content

Commit

Permalink
Minor optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
agronholm committed Nov 13, 2024
1 parent 76a3594 commit f25559c
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/anyio/_backends/_asyncio.py
Original file line number Diff line number Diff line change
Expand Up @@ -895,15 +895,13 @@ def task_done(_task: asyncio.Task) -> None:
name = get_callable_name(func) if name is None else str(name)
try:
task = create_task(coro, name=name)
except BaseException:
finally:
del _task_states[coro]
raise

_task_states[task] = task_state
self.cancel_scope._tasks.add(task)
self._tasks.add(task)

del _task_states[coro]
_task_states[task] = task_state
if task.done():
# This can happen with eager task factories
task_done(task)
Expand Down

0 comments on commit f25559c

Please sign in to comment.