diff options
author | Pablo Galindo <Pablogsal@gmail.com> | 2021-03-10 08:50:16 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-10 08:50:16 (GMT) |
commit | a6d0182879d0bf275c4feb38b57f73236ab9c06c (patch) | |
tree | 96ea6d412c90761f0c526e4c8e230ea3926baaf2 /Modules/gcmodule.c | |
parent | e89380765df8f0f02c90ad417e164d1597bd0b05 (diff) | |
download | cpython-a6d0182879d0bf275c4feb38b57f73236ab9c06c.zip cpython-a6d0182879d0bf275c4feb38b57f73236ab9c06c.tar.gz cpython-a6d0182879d0bf275c4feb38b57f73236ab9c06c.tar.bz2 |
[3.8] bpo-43439: Add audit hooks for gc functions (GH-24794). (GH-24810)
(cherry picked from commit b4f9089d4aa787c5b74134c98e5f0f11d9e63095)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
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 5a6a81d..7a37a16 100644 --- a/Modules/gcmodule.c +++ b/Modules/gcmodule.c @@ -1480,6 +1480,10 @@ static PyObject * gc_get_referrers(PyObject *self, PyObject *args) { int i; + if (PySys_Audit("gc.get_referrers", "O", args) < 0) { + return NULL; + } + PyObject *result = PyList_New(0); if (!result) return NULL; @@ -1508,6 +1512,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) @@ -1549,6 +1556,10 @@ gc_get_objects_impl(PyObject *module, Py_ssize_t generation) PyObject* result; struct _gc_runtime_state *state = &_PyRuntime.gc; + if (PySys_Audit("gc.get_objects", "n", generation) < 0) { + return NULL; + } + result = PyList_New(0); if (result == NULL) { return NULL; |