Skip to content

Commit 93f7f9b

Browse files
committed
pythongh-107954: Add audit event to PyConfig_Set()
1 parent 17718b0 commit 93f7f9b

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

Doc/c-api/init_config.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,8 @@ Some options are read from the :mod:`sys` attributes. For example, the option
619619
The caller must have an :term:`attached thread state`. The function cannot
620620
be called before Python initialization nor after Python finalization.
621621
622+
.. audit-event:: cpython.PyConfig_Set name,value c.PyConfig_Set
623+
622624
.. versionadded:: 3.14
623625
624626

Python/initconfig.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4527,6 +4527,10 @@ config_set_sys_flag(const PyConfigSpec *spec, int int_value)
45274527
int
45284528
PyConfig_Set(const char *name, PyObject *value)
45294529
{
4530+
if (PySys_Audit("cpython.PyConfig_Set", "sO", name, value) < 0) {
4531+
return -1;
4532+
}
4533+
45304534
const PyConfigSpec *spec = config_find_spec(name);
45314535
if (spec == NULL) {
45324536
spec = preconfig_find_spec(name);

0 commit comments

Comments
 (0)