Skip to content

Commit

Permalink
move assert
Browse files Browse the repository at this point in the history
  • Loading branch information
graingert committed Dec 24, 2024
1 parent 174bd07 commit d0ada54
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/trio/_core/_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -2104,14 +2104,14 @@ def deliver_ki(self) -> None:
def _deliver_ki_cb(self) -> None:
if not self.ki_pending:
return
# Can't happen because main_task and run_sync_soon_task are created at
# the same time -- so even if KI arrives before main_task is created,
# we won't get here until afterwards.
assert self.main_task is not None
if self.main_task_outcome is not None:
# We're already in the process of exiting -- leave ki_pending set
# and we'll check it again on our way out of run().
return
# Can't happen because main_task and run_sync_soon_task are created at
# the same time -- so even if KI arrives before main_task is created,
# we won't get here until afterwards.
assert self.main_task is not None
self.main_task._attempt_delivery_of_pending_ki()

################
Expand Down

0 comments on commit d0ada54

Please sign in to comment.