diff --git a/Doc/c-api/init_config.rst b/Doc/c-api/init_config.rst index 74f34f81d4655f..021bf7a012e55c 100644 --- a/Doc/c-api/init_config.rst +++ b/Doc/c-api/init_config.rst @@ -619,6 +619,8 @@ Some options are read from the :mod:`sys` attributes. For example, the option The caller must have an :term:`attached thread state`. The function cannot be called before Python initialization nor after Python finalization. + .. audit-event:: cpython.PyConfig_Set name,value c.PyConfig_Set + .. versionadded:: 3.14 diff --git a/Python/initconfig.c b/Python/initconfig.c index 39e70bd5f32e71..bb81dff7e76559 100644 --- a/Python/initconfig.c +++ b/Python/initconfig.c @@ -4527,6 +4527,10 @@ config_set_sys_flag(const PyConfigSpec *spec, int int_value) int PyConfig_Set(const char *name, PyObject *value) { + if (PySys_Audit("cpython.PyConfig_Set", "sO", name, value) < 0) { + return -1; + } + const PyConfigSpec *spec = config_find_spec(name); if (spec == NULL) { spec = preconfig_find_spec(name);