Skip to content

Commit 45f78f4

Browse files
committed
break lots before other checks, minor phrasing improvement in docstring
1 parent 21cf0d6 commit 45f78f4

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/trio/_core/_run.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1821,6 +1821,11 @@ async def python_wrapper(orig_coro: Awaitable[RetT]) -> RetT:
18211821
return task
18221822

18231823
def task_exited(self, task: Task, outcome: Outcome[Any]) -> None:
1824+
if task in GLOBAL_PARKING_LOT_BREAKER:
1825+
for lot in GLOBAL_PARKING_LOT_BREAKER[task]:
1826+
lot.break_lot(task)
1827+
del GLOBAL_PARKING_LOT_BREAKER[task]
1828+
18241829
if (
18251830
task._cancel_status is not None
18261831
and task._cancel_status.abandoned_by_misnesting
@@ -1860,12 +1865,6 @@ def task_exited(self, task: Task, outcome: Outcome[Any]) -> None:
18601865
assert task._parent_nursery is not None, task
18611866
task._parent_nursery._child_finished(task, outcome)
18621867

1863-
# before or after the other stuff in this function?
1864-
if task in GLOBAL_PARKING_LOT_BREAKER:
1865-
for lot in GLOBAL_PARKING_LOT_BREAKER[task]:
1866-
lot.break_lot(task)
1867-
del GLOBAL_PARKING_LOT_BREAKER[task]
1868-
18691868
if "task_exited" in self.instruments:
18701869
self.instruments.call("task_exited", task)
18711870

src/trio/_sync.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,7 @@ async def acquire(self) -> None:
783783
"""Acquire the underlying lock, blocking if necessary.
784784
785785
Raises:
786-
BrokenResourceError: if the owner of the lock exits without releasing.
786+
BrokenResourceError: if the owner of the underlying lock exits without releasing.
787787
"""
788788
await self._lock.acquire()
789789

0 commit comments

Comments
 (0)