This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: asyncio.wait_for does not wait for task/future to be completed in all cases
Type: behavior Stage: resolved
Components: asyncio Versions: Python 3.8, Python 3.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: asvetlov, miss-islington, rkojedzinszky, uriyyo, yselivanov
Priority: normal Keywords: patch

Created on 2020-09-30 11:01 by rkojedzinszky, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 22461 merged rkojedzinszky, 2020-09-30 11:04
PR 23840 merged miss-islington, 2020-12-18 17:26
PR 23841 merged miss-islington, 2020-12-18 17:26
Messages (6)
msg377695 - (view) Author: Richard Kojedzinszky (rkojedzinszky) * Date: 2020-09-30 11:01
This code should run without errors:

```
#!/usr/bin/env python

import asyncio

async def task1():
    cv = asyncio.Condition()

    async with cv:
        await asyncio.wait_for(cv.wait(), 10)

async def main(loop):
    task = loop.create_task(task1())

    await asyncio.sleep(0)

    task.cancel()

    res = await asyncio.wait({task})

if __name__ == '__main__':
    loop = asyncio.get_event_loop()

    loop.run_until_complete(main(loop))
```
msg383307 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2020-12-18 17:26
New changeset 17ef4319a34f5a2f95e7823dfb5f5b8cff11882d by Richard Kojedzinszky in branch 'master':
bpo-41891: ensure asyncio.wait_for waits for task completion (#22461)
https://github.com/python/cpython/commit/17ef4319a34f5a2f95e7823dfb5f5b8cff11882d
msg383308 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2020-12-18 17:26
Thanks for the PR, Richard!
msg383311 - (view) Author: miss-islington (miss-islington) Date: 2020-12-18 17:45
New changeset a3dec9d8ec5ae142946ff6b94947a183d7c48f35 by Miss Islington (bot) in branch '3.8':
bpo-41891: ensure asyncio.wait_for waits for task completion (GH-22461)
https://github.com/python/cpython/commit/a3dec9d8ec5ae142946ff6b94947a183d7c48f35
msg383322 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2020-12-18 19:19
New changeset 82dbfd5a04863d8b6363527e6a34a90c9aa5691b by Miss Islington (bot) in branch '3.9':
bpo-41891: ensure asyncio.wait_for waits for task completion (GH-22461) (#23840)
https://github.com/python/cpython/commit/82dbfd5a04863d8b6363527e6a34a90c9aa5691b
msg383324 - (view) Author: Yurii Karabas (uriyyo) * (Python triager) Date: 2020-12-18 20:13
Yurii no worries, I am happy that this issue is resolved)
History
Date User Action Args
2022-04-11 14:59:36adminsetgithub: 86057
2020-12-18 20:13:02uriyyosetnosy: + uriyyo
messages: + msg383324
2020-12-18 19:19:23yselivanovsetmessages: + msg383322
2020-12-18 17:45:32miss-islingtonsetnosy: + miss-islington
messages: + msg383311
2020-12-18 17:28:20yselivanovlinkissue42600 superseder
2020-12-18 17:26:50yselivanovsetstatus: open -> closed
nosy: - miss-islington

resolution: fixed
stage: patch review -> resolved
2020-12-18 17:26:37miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request22701
2020-12-18 17:26:36yselivanovsetnosy: - miss-islington
messages: + msg383308
2020-12-18 17:26:26miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request22700
2020-12-18 17:26:20yselivanovsetmessages: + msg383307
2020-09-30 11:04:51rkojedzinszkysetkeywords: + patch
stage: patch review
pull_requests: + pull_request21487
2020-09-30 11:01:52rkojedzinszkycreate