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 — [3.14] change in behaviour in gc.get_referrers(some_local) · Issue #125603 · python/cpython

[3.14] change in behaviour in gc.get_referrers(some_local) #125603

New issue
Copy link
New issue
Copy link
Open
Open
[3.14] change in behaviour in gc.get_referrers(some_local)#125603
Copy link
Assignees
markshannon
Labels
3.14bugs and security fixesbugs and security fixestriagedThe issue has been accepted as valid by a triager.The issue has been accepted as valid by a triager.type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@graingert
graingert
opened on Oct 16, 2024
Issue body actions

Bug report

Bug description:

import gc

async def demo():
    class A:
        pass

    a = A()
    print(gc.get_referrers(a))


try:
    demo().send(None)
except StopIteration as e:
    print(f"{e.value=}")

on 3.11-3.13 this prints:

[]
e.value=None

on 3.14 this prints:

[<coroutine object demo at 0x7d00fff85000>]
e.value=None

this makes gc.get_referrers less useful in detecting cyclic garbage where I'd like to be able to make the assertion that the current frame is the only referrer to an Exception.

the alternative is to hold a weak reference to the object, delete the object and see if the weak reference is dead with the gc disabled. But then I don't get any debug information in my failing test of why the object is still alive.

CPython versions tested on:

3.14, CPython main branch

Operating systems tested on:

Linux

note: @markshannon asked me to open this issue

Linked PRs

  • GH-125603: Don't count executing generators and coroutines as referrers in gc.gc_referrers. #125640

Activity

  1. graingert
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    3.14bugs and security fixesbugs and security fixes
    on Oct 16, 2024
  2. graingert
    assigned
    markshannon
    on Oct 16, 2024
  3. graingert
    added
    triagedThe issue has been accepted as valid by a triager.The issue has been accepted as valid by a triager.
    on Oct 16, 2024
  4. graingert commented on Oct 16, 2024

    @graingert
    graingert
    on Oct 16, 2024
    ContributorAuthor
    More actions

    The behavior change was caused by this PR #124392

  5. markshannon
    added
    skip news
    and removed
    skip news
    on Oct 17, 2024
  6. musicinmybrain
    added 2 commits that reference this issue on Feb 14, 2025

    Add xfail to test_ki_protection_doesnt_leave_cyclic_garbage on Python…

    43b30ac

    Add xfail to test_ki_protection_doesnt_leave_cyclic_garbage on Python…

    02b338e
  7. kumaraditya303 commented on Jul 25, 2025

    @kumaraditya303
    kumaraditya303
    on Jul 25, 2025
    Contributor
    More actions

    The behavior change is undesirable and breaks tests of many projects, should this be release blocker @hugovk ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @markshannon
    markshannon

Labels

3.14bugs and security fixesbugs and security fixestriagedThe issue has been accepted as valid by a triager.The issue has been accepted as valid by a triager.type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Projects

No projects

    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.