diff options
author | Pablo Galindo <Pablogsal@gmail.com> | 2021-03-10 00:53:57 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-10 00:53:57 (GMT) |
commit | b4f9089d4aa787c5b74134c98e5f0f11d9e63095 (patch) | |
tree | 26bfa4b05e2e5371f1473ca108b1451bcd49de6d /Modules/gcmodule.c | |
parent | 62a03cd490f81c0fb01eaceb31aa8a4c7800ed0e (diff) | |
download | cpython-b4f9089d4aa787c5b74134c98e5f0f11d9e63095.zip cpython-b4f9089d4aa787c5b74134c98e5f0f11d9e63095.tar.gz cpython-b4f9089d4aa787c5b74134c98e5f0f11d9e63095.tar.bz2 |
bpo-43439: Add audit hooks for gc functions (GH-24794)
Diffstat (limited to 'Modules/gcmodule.c')
-rw-r--r-- | Modules/gcmodule.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c index 21f6bd1..225da2b 100644 --- a/Modules/gcmodule.c +++ b/Modules/gcmodule.c @@ -1690,6 +1690,10 @@ Return the list of objects that directly refer to any of objs."); static PyObject * gc_get_referrers(PyObject *self, PyObject *args) { + if (PySys_Audit("gc.get_referrers", "O", args) < 0) { + return NULL; + } + PyObject *result = PyList_New(0); if (!result) { return NULL; @@ -1720,6 +1724,9 @@ static PyObject * gc_get_referents(PyObject *self, PyObject *args) { Py_ssize_t i; + if (PySys_Audit("gc.get_referents", "O", args) < 0) { + return NULL; + } PyObject *result = PyList_New(0); if (result == NULL) @@ -1762,6 +1769,10 @@ gc_get_objects_impl(PyObject *module, Py_ssize_t generation) PyObject* result; GCState *gcstate = &tstate->interp->gc; + if (PySys_Audit("gc.get_objects", "n", generation) < 0) { + return NULL; + } + result = PyList_New(0); if (result == NULL) { return NULL; |