Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always force tasks off the queue #553

Merged
merged 2 commits into from
Jul 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion trio/_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -968,7 +968,10 @@ def abort_fn(_):
return _core.Abort.SUCCEEDED

self._get_wait[task] = None
value = await _core.wait_task_rescheduled(abort_fn)
try:
value = await _core.wait_task_rescheduled(abort_fn)
finally:
self._get_wait.pop(task, None)
return value

@aiter_compat
Expand Down
6 changes: 6 additions & 0 deletions trio/tests/test_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from ..testing import wait_all_tasks_blocked, assert_checkpoints

from .. import _core
from .. import _timeouts
from .._timeouts import sleep_forever
from .._sync import *

Expand Down Expand Up @@ -407,6 +408,11 @@ async def test_Queue():
q.get_nowait()
assert q.empty()

with _timeouts.move_on_after(0.01) as timeout_scope:
await q.get()
assert timeout_scope.cancelled_caught
await q.put("Test for https://github.com/python-trio/trio/pull/553")


async def test_Queue_iter():
q = Queue(1)
Expand Down