8000 bpo-42130: Fix for explicit suppressing of cancellations in wait_for() by Dreamsorcerer · Pull Request #28149 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-42130: Fix for explicit suppressing of cancellations in wait_for() #28149

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

Closed
wants to merge 20 commits into from
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Update test_tasks.py
  • Loading branch information
Dreamsorcerer authored Sep 3, 2021
commit 7ff2c04b3273f84591f49656b1c96bb63d430f3f
6 changes: 3 additions & 3 deletions Lib/test/test_asyncio/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1026,21 +1026,21 @@ def gen():

def test_wait_for_does_not_suppress_cancellation(self):
async def inner():
return
await asyncio.sleep(0)

async def with_for_coro():
await wait_for(inner(), timeout=1)
assert False, 'End of with_for_coro. Should not be reached!'

async def main(self):
async def main():
task = asyncio.create_task(with_for_coro())
await asyncio.sleep(0)
self.assertFalse(task.done())
task.cancel()
with self.assertRaises(asyncio.CancelledError):
await task

asyncio.run(main(self))
asyncio.run(main())

def test_wait_for_waits_for_task_cancellation(self):
loop = asyncio.new_event_loop()
Expand Down
0