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 — Remove `yield from` usage from asyncio tests · Issue #100113 · python/cpython

Remove yield from usage from asyncio tests #100113

New issue
Copy link
New issue
Copy link
Closed
Closed
Remove yield from usage from asyncio tests#100113
Copy link
Labels
topic-asyncio

Description

@kumaraditya303
kumaraditya303
opened on Dec 8, 2022
Issue body actions

Support for yield from was deprecated and removed so it should be removed.

See

cpython/Lib/test/test_asyncio/test_tasks.py

Lines 2093 to 2100 in cd67c1b

# The indirection fut->child_coro is needed since otherwise the
# gathering task is done at the same time as the child future
def child_coro():
return (yield from fut)
gather_future = asyncio.gather(child_coro())
return asyncio.ensure_future(gather_future)
gather_task = loop.run_until_complete(create())

Linked PRs

  • GH-100113: remove remaining yield from usage from asyncio tests  #100114

Activity

  1. kumaraditya303
    added
    topic-asyncio
    on Dec 8, 2022
  2. ezio-melotti
    added this to asyncioon Dec 8, 2022
  3. ezio-melotti
    moved this to Todo in asyncioon Dec 8, 2022
  4. vstinner commented on Dec 8, 2022

    @vstinner
    vstinner
    on Dec 8, 2022
    Member
    More actions

    There are a few yield from in asyncio tests (Lib/test/test_asyncio/):

    test_futures.py:296:            x = yield from f
    test_futures.py:298:            y = yield from f
    test_futures.py:303:        self.assertEqual(next(g), f)  # First yield from f.
    test_futures.py:306:        # The second "yield from f" does not yield f.
    test_futures.py:408:            yield from fut
    test_pep492.py:152:            yield from ()
    test_sslproto.py:99:        # yield from waiter hang if lost_connection was called.
    test_tasks.py:2096:                return (yield from fut)
    utils.py:271:            yield from _run_test_server(address=path, use_ssl=use_ssl,
    utils.py:278:    yield from _run_test_server(address=(host, port), use_ssl=use_ssl,
    
  5. kumaraditya303
    added a commit that references this issue on Dec 9, 2022

    GH-100113: remove remaining `yield from` usage from `asyncio` tests (#…

    0448dea
  6. kumaraditya303 commented on Dec 9, 2022

    @kumaraditya303
    kumaraditya303
    on Dec 9, 2022
    ContributorAuthor
    More actions

    There are a few yield from in asyncio tests (Lib/test/test_asyncio/):

    I think those are testing the internal implementation of futures and they are not used with asyncio APIs. I don't think they should be changed to await.

  7. gvanrossum commented on Dec 10, 2022

    @gvanrossum
    gvanrossum
    on Dec 10, 2022
    Member
    More actions

    There's a comment referencing yield from on line 66 of asyncio/futures.py that probably should be updated, if indeed we are dropping (or have dropped) yield from support. Similar on line 292 (seems to refer to the same thing).

    Next, in asyncio/tasks.py, line 316 there's an error message complaining about yield instead of yield from. Should that be await too? Again on line 327. The same error messages also occur in _asynciomodule.c.

    Then there's _wrap_awaitable(), also in tasks.py, which on line 687 has a yield from.

    But maybe I'm not understanding how yield from is used here???

  8. kumaraditya303 commented on Mar 16, 2023

    @kumaraditya303
    kumaraditya303
    on Mar 16, 2023
    ContributorAuthor
    More actions

    Then there's _wrap_awaitable(), also in tasks.py, which on line 687 has a yield from.

    This has been removed now.

    Next, in asyncio/tasks.py, line 316 there's an error message complaining about yield instead of yield from. Should that be await too? Again on line 327. The same error messages also occur in _asynciomodule.c.

    That's debugging aid for people who are writing their own awaitables with custom __await__ method.

  9. kumaraditya303 commented on Mar 19, 2023

    @kumaraditya303
    kumaraditya303
    on Mar 19, 2023
    ContributorAuthor
    More actions

    Closing this, anything left can be handled in #102748

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic-asyncio

    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.