mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
gh-116604: Check for gcstate->enabled
in _Py_RunGC in free-threaded build (#116663)
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.
This commit is contained in:
parent
df4784b3b7
commit
5d72b75388
1 changed files with 4 additions and 0 deletions
|
@ -1603,6 +1603,10 @@ _PyObject_GC_Link(PyObject *op)
|
||||||
void
|
void
|
||||||
_Py_RunGC(PyThreadState *tstate)
|
_Py_RunGC(PyThreadState *tstate)
|
||||||
{
|
{
|
||||||
|
GCState *gcstate = get_gc_state();
|
||||||
|
if (!gcstate->enabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
gc_collect_main(tstate, 0, _Py_GC_REASON_HEAP);
|
gc_collect_main(tstate, 0, _Py_GC_REASON_HEAP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue