Skip to content

Commit ac5424d

Browse files
authored
gh-107954: Add audit event to PyConfig_Set() (#132958)
1 parent 070d866 commit ac5424d

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

Doc/c-api/init_config.rst

+2
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

+4
Original file line numberDiff line numberDiff line change
@@ -4539,6 +4539,10 @@ config_set_int_attr(const PyConfigSpec *spec, int value)
45394539
int
45404540
PyConfig_Set(const char *name, PyObject *value)
45414541
{
4542+
if (PySys_Audit("cpython.PyConfig_Set", "sO", name, value) < 0) {
4543+
return -1;
4544+
}
4545+
45424546
const PyConfigSpec *spec = config_find_spec(name);
45434547
if (spec == NULL) {
45444548
spec = preconfig_find_spec(name);

0 commit comments

Comments
 (0)