8000 gh-116604: Check for `gcstate->enabled` in _Py_RunGC in free-threaded build by colesbury · Pull Request #116663 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-116604: Check for gcstate->enabled in _Py_RunGC in free-threaded build #116663

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
Mar 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
gh-116604: Check for gcstate->enabled in _Py_RunGC in free-threaded…
… build

This isn't strictly necessary because the implementation of `gc_should_collect`
already checks `gcstate->enabled` in the free-threaded build, but it seems
like a good idea until the common pieces of gc.c and gc_free_threading.c are
refactored out.
  • Loading branch information
colesbury committed Mar 12, 2024
commit a7ce514a7c0fc3af1f0f39883cb30c6832dc20e0
4 changes: 4 additions & 0 deletions Python/gc_free_threading.c
Original file line number Diff line number Diff line change
Expand Up @@ -1603,6 +1603,10 @@ _PyObject_GC_Link(PyObject *op)
void
_Py_RunGC(PyThreadState *tstate)
{
GCState *gcstate = get_gc_state();
if (!gcstate->enabled) {
return;
}
gc_collect_main(tstate, 0, _Py_GC_REASON_HEAP);
}

Expand Down
0