summaryrefslogtreecommitdiffstats
path: root/Modules/gcmodule.c
diff options
context:
space:
mode:
authorPablo Galindo Salgado <Pablogsal@gmail.com>2024-03-12 23:38:20 (GMT)
committerGitHub <noreply@github.com>2024-03-12 23:38:20 (GMT)
commitdcfb21d8b4c930c4295cd9a75814316e5b103683 (patch)
tree4a13d74cfee81fd202df627021f77939d46f8935 /Modules/gcmodule.c
parentf9d1ec8e803012a521f0673da8c5cba1e9862bf5 (diff)
downloadcpython-dcfb21d8b4c930c4295cd9a75814316e5b103683.zip
cpython-dcfb21d8b4c930c4295cd9a75814316e5b103683.tar.gz
cpython-dcfb21d8b4c930c4295cd9a75814316e5b103683.tar.bz2
[3.12] gh-116604: Correctly honor the gc status when calling _Py_RunGC (GH-116628) (#116653)
Diffstat (limited to 'Modules/gcmodule.c')
-rw-r--r--Modules/gcmodule.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c
index 149a6a0..c9b5aab 100644
--- a/Modules/gcmodule.c
+++ b/Modules/gcmodule.c
@@ -2288,6 +2288,9 @@ void
_Py_RunGC(PyThreadState *tstate)
{
GCState *gcstate = &tstate->interp->gc;
+ if (!gcstate->enabled) {
+ return;
+ }
gcstate->collecting = 1;
gc_collect_generations(tstate);
gcstate->collecting = 0;