mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
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>
This commit is contained in:
parent
baecfbd849
commit
3cc481b9de
7 changed files with 152 additions and 7 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue