Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2324652

Browse files
authored
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 addedto Python 3.13.Move non-limited "PerfMap" C API from Include/sysmodule.h toInclude/cpython/sysmodule.h.
1 parent6db6b30 commit2324652

File tree

8 files changed

+37
-14
lines changed

8 files changed

+37
-14
lines changed

‎Doc/data/stable_abi.dat

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎Doc/whatsnew/3.13.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,6 +1059,11 @@ New Features
10591059
(version 3.13).
10601060
(Contributed by Victor Stinner in:gh:`85283`.)
10611061

1062+
* Add:c:func:`PySys_Audit` and:c:func:`PySys_AuditTuple` functions to the
1063+
limited C API.
1064+
(Contributed by Victor Stinner in:gh:`85283`.)
1065+
1066+
10621067
Porting to Python 3.13
10631068
----------------------
10641069

‎Include/cpython/sysmodule.h

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ PyAPI_FUNC(int) PySys_Audit(
1010
...);
1111
PyAPI_FUNC(int)PySys_AddAuditHook(Py_AuditHookFunction,void*);
1212

13-
PyAPI_FUNC(int)PySys_AuditTuple(
14-
constchar*event,
15-
PyObject*args);
13+
typedefstruct {
14+
FILE*perf_map;
15+
PyThread_type_lockmap_lock;
16+
}PerfMapState;
17+
18+
PyAPI_FUNC(int)PyUnstable_PerfMapState_Init(void);
19+
PyAPI_FUNC(int)PyUnstable_WritePerfMapEntry(
20+
constvoid*code_addr,
21+
unsignedintcode_size,
22+
constchar*entry_name);
23+
PyAPI_FUNC(void)PyUnstable_PerfMapState_Fini(void);

‎Include/sysmodule.h

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,15 @@ Py_DEPRECATED(3.13) PyAPI_FUNC(void) PySys_ResetWarnOptions(void);
2121

2222
PyAPI_FUNC(PyObject*)PySys_GetXOptions(void);
2323

24-
#if !defined(Py_LIMITED_API)
25-
typedefstruct {
26-
FILE*perf_map;
27-
PyThread_type_lockmap_lock;
28-
}PerfMapState;
29-
30-
PyAPI_FUNC(int)PyUnstable_PerfMapState_Init(void);
31-
32-
PyAPI_FUNC(int)PyUnstable_WritePerfMapEntry(constvoid*code_addr,unsignedintcode_size,constchar*entry_name);
33-
34-
PyAPI_FUNC(void)PyUnstable_PerfMapState_Fini(void);
24+
#if !defined(Py_LIMITED_API)||Py_LIMITED_API+0 >=0x030d0000
25+
PyAPI_FUNC(int)PySys_Audit(
26+
constchar*event,
27+
constchar*argFormat,
28+
...);
29+
30+
PyAPI_FUNC(int)PySys_AuditTuple(
31+
constchar*event,
32+
PyObject*args);
3533
#endif
3634

3735
#ifndefPy_LIMITED_API

‎Lib/test/test_stable_abi_ctypes.py

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Add the:c:func:`PySys_Audit` function to the limited C API. Patch by Victor
2+
Stinner.

‎Misc/stable_abi.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2474,3 +2474,7 @@
24742474
added ='3.13'
24752475
[function.PyMem_RawFree]
24762476
added ='3.13'
2477+
[function.PySys_Audit]
2478+
added ='3.13'
2479+
[function.PySys_AuditTuple]
2480+
added ='3.13'

‎PC/python3dll.c

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp