]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-38644: Add _PySys_Audit() which takes tstate (GH-19180)
authorVictor Stinner <vstinner@python.org>
Thu, 26 Mar 2020 17:57:32 +0000 (18:57 +0100)
committerGitHub <noreply@github.com>
Thu, 26 Mar 2020 17:57:32 +0000 (18:57 +0100)
commit08faf0016e1ee590c78f64ddb244767c7801866a
tree17c3ad20544ec8725838cad831d88147f572a6a9
parente0b8101492f6c61dee831425b4d3dae39a953599
bpo-38644: Add _PySys_Audit() which takes tstate (GH-19180)

Add _PySys_Audit() function to the internal C API: similar to
PySys_Audit(), but requires a mandatory tstate parameter.

Cleanup sys_audit_tstate() code: remove code path for NULL tstate,
since the function exits at entry if tstate is NULL. Remove also code
path for NULL tstate->interp: should_audit() now ensures that it is
not NULL (even if tstate->interp cannot be NULL in practice).

PySys_AddAuditHook() now checks if tstate is not NULL to decide if
tstate can be used or not, and tstate is set to NULL if the runtime
is not initialized yet.

Use _PySys_Audit() in sysmodule.c.
Include/cpython/sysmodule.h
Include/internal/pycore_sysmodule.h [new file with mode: 0644]
Makefile.pre.in
PCbuild/pythoncore.vcxproj
PCbuild/pythoncore.vcxproj.filters
Python/pylifecycle.c
Python/sysmodule.c