GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — asyncio.wait should accept generator of tasks as first argument · Issue #78530 · python/cpython

asyncio.wait should accept generator of tasks as first argument #78530

New issue
Copy link
New issue
Copy link
Closed
#103748
Closed
asyncio.wait should accept generator of tasks as first argument#78530
#103748
Copy link
Assignees
kumaraditya303
Labels
3.12only security fixesonly security fixestopic-asynciotype-featureA feature request or enhancementA feature request or enhancement

Description

jnwatson
mannequin
opened on Aug 6, 2018
Issue body actions
BPO 34349
Nosy @asvetlov, @1st1, @jnwatson, @tirkarthi, @epiphyte

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2018-08-06.19:41:06.692>
labels = ['3.8', 'expert-asyncio']
title = 'asyncio.wait should accept generator of tasks as first argument'
updated_at = <Date 2018-08-07.14:20:15.310>
user = 'https://github.com/jnwatson'

bugs.python.org fields:

activity = <Date 2018-08-07.14:20:15.310>
actor = 'yselivanov'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['asyncio']
creation = <Date 2018-08-06.19:41:06.692>
creator = 'jnwatson'
dependencies = []
files = []
hgrepos = []
issue_num = 34349
keywords = []
message_count = 2.0
messages = ['323217', '323241']
nosy_count = 5.0
nosy_names = ['asvetlov', 'yselivanov', 'jnwatson', 'xtreak', 'epiphyte']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = None
url = 'https://bugs.python.org/issue34349'
versions = ['Python 3.8']

Linked PRs

  • GH-78530: add support for generators in asyncio.wait #102761
  • [3.11] GH-78530: clarify docs for generators yielding tasks in asyncio.wait and asyncio.as_completed #103748

Activity

  1. jnwatson commented on Aug 6, 2018

    @jnwatson
    jnwatsonmannequin
    on Aug 6, 2018
    MannequinAuthor
    More actions

    Currently, passing a generator of coroutines or futures as the first parameter of asyncio.wait raises a TypeError. This is in conflict with the documentation calling the first parameter a "sequence".

    Line in question. https://github.com/python/cpython/blob/3.7/Lib/asyncio/tasks.py#L347

    Generators are indeed coroutines, so the check to validate that the first parameter is not a coroutine or a future is too specific.

    I'd suggest replacing that line with a check that the passed-in parameter is iterable, i.e. hasattr(futures, __iter__).

  2. jnwatson
    added
    3.7 (EOL)end of lifeend of life
    topic-asyncio
    on Aug 6, 2018
  3. 1st1 commented on Aug 7, 2018

    @1st1
    1st1
    on Aug 7, 2018
    Member
    More actions

    Since we're deprecating generator-based coroutines anyways, I too think that the check can be relaxed.

  4. 1st1
    added
    3.8 (EOL)end of lifeend of life
    and removed
    3.7 (EOL)end of lifeend of life
    on Aug 7, 2018
  5. ezio-melotti
    transferred this issue fromon Apr 10, 2022
  6. ezio-melotti
    added this to asyncioon Jun 20, 2022
  7. ezio-melotti
    moved this to Todo in asyncioon Jul 17, 2022
  8. kumaraditya303 commented on Dec 2, 2022

    @kumaraditya303
    kumaraditya303
    on Dec 2, 2022
    Contributor
    More actions

    Since generator based coroutines are gone, I think we should relax this check and allow generators.

  9. kumaraditya303
    added
    3.12only security fixesonly security fixes
    and removed
    3.8 (EOL)end of lifeend of life
    on Dec 2, 2022
  10. JelleZijlstra commented on Dec 2, 2022

    @JelleZijlstra
    JelleZijlstra
    on Dec 2, 2022
    Member
    More actions

    Allowing generators in 3.12 seems like a good idea. It's probably also useful to change the documentation in 3.10 and 3.11 to clarify that generators don't work, as #99936 asked for.

    Reacted by Guido van Rossum and Dr. Juan Miguel Cejuela
  11. kumaraditya303 commented on Dec 8, 2022

    @kumaraditya303
    kumaraditya303
    on Dec 8, 2022
    Contributor
    More actions

    Let's do it.

  12. kumaraditya303
    self-assigned this
    on Dec 8, 2022
  13. kumaraditya303
    added
    type-featureA feature request or enhancementA feature request or enhancement
    on Dec 8, 2022
  14. gvanrossum commented on Dec 22, 2022

    @gvanrossum
    gvanrossum
    on Dec 22, 2022
    Member
    More actions

    So there are two separate tasks here, right:

    1. In 3.12, allow generators
    2. In the docs for 3.10 and 3.11, explain that generators are not allowed (maybe allude to 3.12 allowing them)
    Reacted by Jelle Zijlstra and Aaron Carver
  15. gvanrossum commented on Mar 17, 2023

    @gvanrossum
    gvanrossum
    on Mar 17, 2023
    Member
    More actions

    According to GH, the PR will close this issue. But it should remain open until the 3.10/3.11 docs are also updated.

  16. kumaraditya303
    added a commit that references this issue on Mar 17, 2023

    GH-78530: add support for generators in `asyncio.wait` (#102761)

    4f5774f
  17. carljm
    added a commit that references this issue on Mar 17, 2023

    Merge branch 'main' into inlinecomp2

    1a8f4a0
  18. Fidget-Spinner
    added a commit that references this issue on Mar 27, 2023

    pythonGH-78530: add support for generators in `asyncio.wait` (python#…

    8d2b6b5
  19. warsaw
    added a commit that references this issue on Apr 11, 2023

    pythonGH-78530: add support for generators in `asyncio.wait` (python#…

    560c6be
  20. kumaraditya303
    linked a pull request that will close this issue[3.11] GH-78530: clarify docs for generators yielding tasks in `asyncio.wait` and `asyncio.as_completed` #103748on Apr 24, 2023
  21. kumaraditya303
    added a commit that references this issue on Apr 24, 2023

    [3.11] GH-78530: clarify docs for generators yielding tasks in `async…

    16dabf9
  22. kumaraditya303 commented on Apr 24, 2023

    @kumaraditya303
    kumaraditya303
    on Apr 24, 2023
    Contributor
    More actions

    Fixed by #103748

  23. kumaraditya303
    closed this as completedon Apr 24, 2023
  24. github-project-automation
    moved this from Todo to Done in asyncioon Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @kumaraditya303
    kumaraditya303

Labels

3.12only security fixesonly security fixestopic-asynciotype-featureA feature request or enhancementA feature request or enhancement

Projects

  • asyncio
    Status
    Done
    Show more project fields

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.