Skip to content

[3.13] gh-125859: Fix crash when gc.get_objects is called during GC (GH-125882) #125921

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

Merged
merged 1 commit into from
Oct 24, 2024

Conversation

miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Oct 24, 2024

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.
(cherry picked from commit e545ead)

Co-authored-by: Sam Gross [email protected]

…ythonGH-125882)

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.
(cherry picked from commit e545ead)

Co-authored-by: Sam Gross <[email protected]>
@colesbury colesbury enabled auto-merge (squash) October 24, 2024 13:46
@colesbury colesbury merged commit 5c2696b into python:3.13 Oct 24, 2024
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants