diff options
author | Pablo Galindo Salgado <Pablogsal@gmail.com> | 2024-03-12 12:00:49 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-12 12:00:49 (GMT) |
commit | 02918aa96117781261cb1a564e37a861b01eb883 (patch) | |
tree | 77dc25055185df60fb01950c7432466cda2ce9f8 /Python | |
parent | eb947cdc1374842a32fa82249ba3c688abf252dc (diff) | |
download | cpython-02918aa96117781261cb1a564e37a861b01eb883.zip cpython-02918aa96117781261cb1a564e37a861b01eb883.tar.gz cpython-02918aa96117781261cb1a564e37a861b01eb883.tar.bz2 |
gh-116604: Correctly honor the gc status when calling _Py_RunGC (#116628)
Diffstat (limited to 'Python')
-rw-r--r-- | Python/gc.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Python/gc.c b/Python/gc.c index ea3b596..6b3316b 100644 --- a/Python/gc.c +++ b/Python/gc.c @@ -1805,6 +1805,10 @@ _PyObject_GC_Link(PyObject *op) void _Py_RunGC(PyThreadState *tstate) { + GCState *gcstate = get_gc_state(); + if (!gcstate->enabled) { + return; + } gc_collect_main(tstate, GENERATION_AUTO, _Py_GC_REASON_HEAP); } |