mirror of
https://github.com/python/cpython
synced 2024-10-02 23:49:16 +00:00
gh-85283: Add PySys_Audit() to the limited C API (#108571)
The PySys_Audit() function was added in Python 3.8 by the PEP 578 "Python Runtime Audit Hooks". Add also PySys_AuditTuple() to the limited C API, function added to Python 3.13. Move non-limited "PerfMap" C API from Include/sysmodule.h to Include/cpython/sysmodule.h.
This commit is contained in:
parent
6db6b30ac2
commit
232465204e
2
Doc/data/stable_abi.dat
generated
2
Doc/data/stable_abi.dat
generated
|
@ -606,6 +606,8 @@ function,PyStructSequence_NewType,3.2,,
|
|||
function,PyStructSequence_SetItem,3.2,,
|
||||
var,PyStructSequence_UnnamedField,3.11,,
|
||||
var,PySuper_Type,3.2,,
|
||||
function,PySys_Audit,3.13,,
|
||||
function,PySys_AuditTuple,3.13,,
|
||||
function,PySys_FormatStderr,3.2,,
|
||||
function,PySys_FormatStdout,3.2,,
|
||||
function,PySys_GetObject,3.2,,
|
||||
|
|
|
@ -1059,6 +1059,11 @@ New Features
|
|||
(version 3.13).
|
||||
(Contributed by Victor Stinner in :gh:`85283`.)
|
||||
|
||||
* Add :c:func:`PySys_Audit` and :c:func:`PySys_AuditTuple` functions to the
|
||||
limited C API.
|
||||
(Contributed by Victor Stinner in :gh:`85283`.)
|
||||
|
||||
|
||||
Porting to Python 3.13
|
||||
----------------------
|
||||
|
||||
|
|
|
@ -10,6 +10,14 @@ PyAPI_FUNC(int) PySys_Audit(
|
|||
...);
|
||||
PyAPI_FUNC(int) PySys_AddAuditHook(Py_AuditHookFunction, void*);
|
||||
|
||||
PyAPI_FUNC(int) PySys_AuditTuple(
|
||||
const char *event,
|
||||
PyObject *args);
|
||||
typedef struct {
|
||||
FILE* perf_map;
|
||||
PyThread_type_lock map_lock;
|
||||
} PerfMapState;
|
||||
|
||||
PyAPI_FUNC(int) PyUnstable_PerfMapState_Init(void);
|
||||
PyAPI_FUNC(int) PyUnstable_WritePerfMapEntry(
|
||||
const void *code_addr,
|
||||
unsigned int code_size,
|
||||
const char *entry_name);
|
||||
PyAPI_FUNC(void) PyUnstable_PerfMapState_Fini(void);
|
||||
|
|
|
@ -21,17 +21,15 @@ Py_DEPRECATED(3.13) PyAPI_FUNC(void) PySys_ResetWarnOptions(void);
|
|||
|
||||
PyAPI_FUNC(PyObject *) PySys_GetXOptions(void);
|
||||
|
||||
#if !defined(Py_LIMITED_API)
|
||||
typedef struct {
|
||||
FILE* perf_map;
|
||||
PyThread_type_lock map_lock;
|
||||
} PerfMapState;
|
||||
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030d0000
|
||||
PyAPI_FUNC(int) PySys_Audit(
|
||||
const char *event,
|
||||
const char *argFormat,
|
||||
...);
|
||||
|
||||
PyAPI_FUNC(int) PyUnstable_PerfMapState_Init(void);
|
||||
|
||||
PyAPI_FUNC(int) PyUnstable_WritePerfMapEntry(const void *code_addr, unsigned int code_size, const char *entry_name);
|
||||
|
||||
PyAPI_FUNC(void) PyUnstable_PerfMapState_Fini(void);
|
||||
PyAPI_FUNC(int) PySys_AuditTuple(
|
||||
const char *event,
|
||||
PyObject *args);
|
||||
#endif
|
||||
|
||||
#ifndef Py_LIMITED_API
|
||||
|
|
2
Lib/test/test_stable_abi_ctypes.py
generated
2
Lib/test/test_stable_abi_ctypes.py
generated
|
@ -626,6 +626,8 @@ SYMBOL_NAMES = (
|
|||
"PySys_AddWarnOption",
|
||||
"PySys_AddWarnOptionUnicode",
|
||||
"PySys_AddXOption",
|
||||
"PySys_Audit",
|
||||
"PySys_AuditTuple",
|
||||
"PySys_FormatStderr",
|
||||
"PySys_FormatStdout",
|
||||
"PySys_GetObject",
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
Add the :c:func:`PySys_Audit` function to the limited C API. Patch by Victor
|
||||
Stinner.
|
|
@ -2474,3 +2474,7 @@
|
|||
added = '3.13'
|
||||
[function.PyMem_RawFree]
|
||||
added = '3.13'
|
||||
[function.PySys_Audit]
|
||||
added = '3.13'
|
||||
[function.PySys_AuditTuple]
|
||||
added = '3.13'
|
||||
|
|
2
PC/python3dll.c
generated
2
PC/python3dll.c
generated
|
@ -568,6 +568,8 @@ EXPORT_FUNC(PyStructSequence_SetItem)
|
|||
EXPORT_FUNC(PySys_AddWarnOption)
|
||||
EXPORT_FUNC(PySys_AddWarnOptionUnicode)
|
||||
EXPORT_FUNC(PySys_AddXOption)
|
||||
EXPORT_FUNC(PySys_Audit)
|
||||
EXPORT_FUNC(PySys_AuditTuple)
|
||||
EXPORT_FUNC(PySys_FormatStderr)
|
||||
EXPORT_FUNC(PySys_FormatStdout)
|
||||
EXPORT_FUNC(PySys_GetObject)
|
||||
|
|
Loading…
Reference in a new issue