Don't run garbage collection on interpreter exit if it was explicitly… · python/cpython@fef7e94 · GitHub
Skip to content

Commit fef7e94

Browse files
committed
Don't run garbage collection on interpreter exit if it was explicitly disabled
by the user.
1 parent 9e3ef52 commit fef7e94

3 files changed

Lines changed: 14 additions & 4 deletions

File tree

Include/objimpl.h

Lines changed: 2 additions & 1 deletion

Modules/gcmodule.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1596,6 +1596,15 @@ PyGC_Collect(void)
15961596
return n;
15971597
}
15981598

1599+
Py_ssize_t
1600+
_PyGC_CollectIfEnabled(void)
1601+
{
1602+
if (!enabled)
1603+
return 0;
1604+
1605+
return PyGC_Collect();
1606+
}
1607+
15991608
Py_ssize_t
16001609
_PyGC_CollectNoFail(void)
16011610
{

Python/pylifecycle.c

Lines changed: 3 additions & 3 deletions

0 commit comments

Comments
 (0)