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 — TaskGroup's task's exception's participate in a reference cycle, via TaskGroup.create_task -> task -> exception and loop.create_task -> task -> exception · Issue #128552 · python/cpython

TaskGroup's task's exception's participate in a reference cycle, via TaskGroup.create_task -> task -> exception and loop.create_task -> task -> exception #128552

New issue
Copy link
New issue
Copy link
Closed
Closed
TaskGroup's task's exception's participate in a reference cycle, via TaskGroup.create_task -> task -> exception and loop.create_task -> task -> exception#128552
Copy link
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-asynciotype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@graingert
graingert
opened on Jan 6, 2025
Issue body actions

Bug report

Bug description:

the following test fails when run with eager tasks

    async def test_exception_refcycles_parent_task(self):
        """Test that TaskGroup deletes self._parent_task"""
        tg = asyncio.TaskGroup()
        exc = None

        class _Done(Exception):
            pass

        async def coro_fn():
            async with tg:
                raise _Done

        try:
            async with asyncio.TaskGroup() as tg2:
                tg2.create_task(coro_fn())
        except* _Done as excs:
            exc = excs.exceptions[0].exceptions[0]

        self.assertIsInstance(exc, _Done)
        self.assertListEqual(gc.get_referrers(exc), no_other_refs())

CPython versions tested on:

3.14

Operating systems tested on:

Linux

Linked PRs

  • gh-128552: fix refcycles in eager task creation #128553
  • [3.13] gh-128552: fix refcycles in eager task creation (#128553) #128585
  • [3.12] gh-128588: gh-128550: gh-128552: fix refcycles in eager task creation (#128553) and remove eager tasks optimization that missed and introduced incorrect cancellations (python#129063) #128586

Activity

  1. graingert
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Jan 6, 2025
  2. graingert
    added 2 commits that reference this issue on Jan 6, 2025

    pythongh-128552: fix refcycles in eager task creation

    c82f30b

    Rename 2025-01-06-18-41-08.gh-issue-pythongh-128552.fV-f8j.rst to 202…

    9700ebf
  3. picnixz
    added
    topic-asyncio
    on Jan 6, 2025
  4. github-project-automation
    moved this to Todo in asyncioon Jan 6, 2025
  5. github-project-automation
    added this to asyncioon Jan 6, 2025
  6. picnixz
    added
    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
    on Jan 6, 2025
  7. kumaraditya303
    added a commit that references this issue on Jan 7, 2025

    gh-128552: fix refcycles in eager task creation (#128553)

    61b9811
  8. graingert
    added a commit that references this issue on Jan 7, 2025

    pythongh-128552: fix refcycles in eager task creation (python#128553)

    ceaafff
  9. srinivasreddy
    added a commit that references this issue on Jan 8, 2025

    pythongh-128552: fix refcycles in eager task creation (python#128553)

    c50dfd7
  10. kumaraditya303
    added a commit that references this issue on Jan 8, 2025

    [3.13] gh-128552: fix refcycles in eager task creation (#128553) (#12…

    1383588
  11. kumaraditya303
    closed this as completedon Jan 20, 2025
  12. github-project-automation
    moved this from Todo to Done in asyncioon Jan 20, 2025
  13. graingert commented on Jan 20, 2025

    @graingert
    graingert
    on Jan 20, 2025
    ContributorAuthor
    More actions

    still waiting for the backports to 3.12 on this

  14. graingert
    reopened this on Jan 20, 2025
  15. github-project-automation
    moved this from Done to In Progress in asyncioon Jan 20, 2025
  16. graingert commented on Jan 20, 2025

    @graingert
    graingert
    on Jan 20, 2025
    ContributorAuthor
    More actions

    once #129063 is in 3.12 we can merge #128586

  17. kumaraditya303
    closed this as completedon Jan 21, 2025
  18. github-project-automation
    moved this from In Progress to Done in asyncioon Jan 21, 2025
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

    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-asynciotype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    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.