diff options
-rw-r--r-- | Doc/data/stable_abi.dat | 2 | ||||
-rw-r--r-- | Doc/whatsnew/3.13.rst | 5 | ||||
-rw-r--r-- | Include/cpython/sysmodule.h | 14 | ||||
-rw-r--r-- | Include/sysmodule.h | 20 | ||||
-rw-r--r-- | Lib/test/test_stable_abi_ctypes.py | 2 | ||||
-rw-r--r-- | Misc/NEWS.d/next/C API/2023-08-28-17-40-51.gh-issue-85283.raFNiD.rst | 2 | ||||
-rw-r--r-- | Misc/stable_abi.toml | 4 | ||||
-rwxr-xr-x | PC/python3dll.c | 2 |
8 files changed, 37 insertions, 14 deletions
diff --git a/Doc/data/stable_abi.dat b/Doc/data/stable_abi.dat index 267d2b8..811b1bd 100644 --- a/Doc/data/stable_abi.dat +++ b/Doc/data/stable_abi.dat @@ -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,, diff --git a/Doc/whatsnew/3.13.rst b/Doc/whatsnew/3.13.rst index 0ff5f43..42e0593 100644 --- a/Doc/whatsnew/3.13.rst +++ b/Doc/whatsnew/3.13.rst @@ -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 ---------------------- diff --git a/Include/cpython/sysmodule.h b/Include/cpython/sysmodule.h index 36c4f89..df12ae4 100644 --- a/Include/cpython/sysmodule.h +++ b/Include/cpython/sysmodule.h @@ -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); diff --git a/Include/sysmodule.h b/Include/sysmodule.h index 225e060..7406513 100644 --- a/Include/sysmodule.h +++ b/Include/sysmodule.h @@ -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; - -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); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030d0000 +PyAPI_FUNC(int) PySys_Audit( + const char *event, + const char *argFormat, + ...); + +PyAPI_FUNC(int) PySys_AuditTuple( + const char *event, + PyObject *args); #endif #ifndef Py_LIMITED_API diff --git a/Lib/test/test_stable_abi_ctypes.py b/Lib/test/test_stable_abi_ctypes.py index 0c831c4..6d5353c 100644 --- a/Lib/test/test_stable_abi_ctypes.py +++ b/Lib/test/test_stable_abi_ctypes.py @@ -626,6 +626,8 @@ SYMBOL_NAMES = ( "PySys_AddWarnOption", "PySys_AddWarnOptionUnicode", "PySys_AddXOption", + "PySys_Audit", + "PySys_AuditTuple", "PySys_FormatStderr", "PySys_FormatStdout", "PySys_GetObject", diff --git a/Misc/NEWS.d/next/C API/2023-08-28-17-40-51.gh-issue-85283.raFNiD.rst b/Misc/NEWS.d/next/C API/2023-08-28-17-40-51.gh-issue-85283.raFNiD.rst new file mode 100644 index 0000000..45ffda3 --- /dev/null +++ b/Misc/NEWS.d/next/C API/2023-08-28-17-40-51.gh-issue-85283.raFNiD.rst @@ -0,0 +1,2 @@ +Add the :c:func:`PySys_Audit` function to the limited C API. Patch by Victor +Stinner. diff --git a/Misc/stable_abi.toml b/Misc/stable_abi.toml index f8ee973..75c260c 100644 --- a/Misc/stable_abi.toml +++ b/Misc/stable_abi.toml @@ -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' diff --git a/PC/python3dll.c b/PC/python3dll.c index dd3be3a..d12889f 100755 --- a/PC/python3dll.c +++ b/PC/python3dll.c @@ -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) |