summaryrefslogtreecommitdiffstats
path: root/Python/gc_free_threading.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/gc_free_threading.c')
-rw-r--r--Python/gc_free_threading.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Python/gc_free_threading.c b/Python/gc_free_threading.c
index 59e7601..2b13d1f 100644
--- a/Python/gc_free_threading.c
+++ b/Python/gc_free_threading.c
@@ -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);
}