bpo-38644: Add _PySys_Audit() which takes tstate by vstinner · Pull Request #19180 · python/cpython · GitHub
Skip to content

bpo-38644: Add _PySys_Audit() which takes tstate - #19180

Merged
vstinner merged 2 commits into
python:masterfrom
vstinner:sys_audit_tstate
Mar 26, 2020
Merged

bpo-38644: Add _PySys_Audit() which takes tstate#19180
vstinner merged 2 commits into
python:masterfrom
vstinner:sys_audit_tstate

Conversation

@vstinner

@vstinner vstinner commented Mar 26, 2020

Copy link
Copy Markdown
Member

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.

https://bugs.python.org/issue38644

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.
@vstinner

Copy link
Copy Markdown
Member Author

@vstinner

Copy link
Copy Markdown
Member Author

@vstinner
vstinner merged commit 08faf00 into python:master Mar 26, 2020
@vstinner
vstinner deleted the sys_audit_tstate branch March 26, 2020 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants