diff options
author | scoder <stefan_ml@behnel.de> | 2021-04-28 16:12:16 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-28 16:12:16 (GMT) |
commit | 3cc481b9de43c234889c8010e7da3af7c0f42319 (patch) | |
tree | 1166babff0120ad235c37789907d640eec280c8f /Include/objimpl.h | |
parent | baecfbd849dbf42360d3a84af6cc13160838f24d (diff) | |
download | cpython-3cc481b9de43c234889c8010e7da3af7c0f42319.zip cpython-3cc481b9de43c234889c8010e7da3af7c0f42319.tar.gz cpython-3cc481b9de43c234889c8010e7da3af7c0f42319.tar.bz2 |
bpo-28254: Add a C-API for controlling the GC state (GH-25687)
Add new C-API functions to control the state of the garbage collector:
PyGC_Enable(), PyGC_Disable(), PyGC_IsEnabled(),
corresponding to the functions in the gc module.
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Diffstat (limited to 'Include/objimpl.h')
-rw-r--r-- | Include/objimpl.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Include/objimpl.h b/Include/objimpl.h index 1408d05..689c42b 100644 --- a/Include/objimpl.h +++ b/Include/objimpl.h @@ -150,8 +150,12 @@ PyAPI_FUNC(PyVarObject *) _PyObject_NewVar(PyTypeObject *, Py_ssize_t); * ========================== */ -/* C equivalent of gc.collect() which ignores the state of gc.enabled. */ +/* C equivalent of gc.collect(). */ PyAPI_FUNC(Py_ssize_t) PyGC_Collect(void); +/* C API for controlling the state of the garbage collector */ +PyAPI_FUNC(int) PyGC_Enable(void); +PyAPI_FUNC(int) PyGC_Disable(void); +PyAPI_FUNC(int) PyGC_IsEnabled(void); /* Test if a type has a GC head */ #define PyType_IS_GC(t) PyType_HasFeature((t), Py_TPFLAGS_HAVE_GC) |