Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-125859: Fix crash when gc.get_objects is called during GC #125882

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Commits on Oct 23, 2024

  1. pythongh-125859: Fix crash when gc.get_objects is called during GC

    This fixes a crash when `gc.get_objects()` or `gc.get_referrers()` is
    called during a GC in the free threading build. Switch to
    `_PyObjectStack` to avoid corrupting the `struct worklist` linked list
    maintained by the GC. Also, don't return objects that are frozen
    (gc.freeze) or in the process of being collected to more closely match
    the behavior of the default build.
    colesbury committed Oct 23, 2024
    Configuration menu
    Copy the full SHA
    aa21b07 View commit details
    Browse the repository at this point in the history
  2. Ensure objects found by gc.get_objects() are kept alive.

    After the `_PyEval_StartTheWorld()` call, other threads may be running
    and mutating objects. Ensure that the objects are kept alive by
    incref'ing them when they're added to the `_PyObjectStack`.
    colesbury committed Oct 23, 2024
    Configuration menu
    Copy the full SHA
    b6b9b7a View commit details
    Browse the repository at this point in the history