Skip to content

Commit df2a40d

Browse files
committed
Add API in the sys module
1 parent 746c1fe commit df2a40d

File tree

2 files changed

+75
-1
lines changed

2 files changed

+75
-1
lines changed

Python/clinic/sysmodule.c.h

+37-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/sysmodule.c

+38
Original file line numberDiff line numberDiff line change
@@ -1994,6 +1994,42 @@ sys_getandroidapilevel_impl(PyObject *module)
19941994
}
19951995
#endif /* ANDROID_API_LEVEL */
19961996

1997+
/*[clinic input]
1998+
sys._activate_perf_trampoline
1999+
2000+
Activate the perf profiler trampoline.
2001+
[clinic start generated code]*/
2002+
2003+
static PyObject *
2004+
sys__activate_perf_trampoline_impl(PyObject *module)
2005+
/*[clinic end generated code: output=248f6dc862887fd0 input=67667f43ffabb1e4]*/
2006+
{
2007+
if (_PyPerfTrampoline_Init(1) < 0) {
2008+
return NULL;
2009+
}
2010+
Py_RETURN_NONE;
2011+
}
2012+
2013+
2014+
/*[clinic input]
2015+
sys._deactivate_perf_trampoline
2016+
2017+
Activate the perf profiler trampoline.
2018+
[clinic start generated code]*/
2019+
2020+
static PyObject *
2021+
sys__deactivate_perf_trampoline_impl(PyObject *module)
2022+
/*[clinic end generated code: output=7dde745eb7ba5e54 input=3d4fbb4aef9ad3d8]*/
2023+
{
2024+
if (_PyPerfTrampoline_Init(0) < 0) {
2025+
return NULL;
2026+
}
2027+
Py_RETURN_NONE;
2028+
}
2029+
2030+
2031+
2032+
19972033
static PyMethodDef sys_methods[] = {
19982034
/* Might as well keep this in alphabetic order */
19992035
SYS_ADDAUDITHOOK_METHODDEF
@@ -2047,6 +2083,8 @@ static PyMethodDef sys_methods[] = {
20472083
METH_VARARGS | METH_KEYWORDS, set_asyncgen_hooks_doc},
20482084
SYS_GET_ASYNCGEN_HOOKS_METHODDEF
20492085
SYS_GETANDROIDAPILEVEL_METHODDEF
2086+
SYS__ACTIVATE_PERF_TRAMPOLINE_METHODDEF
2087+
SYS__DEACTIVATE_PERF_TRAMPOLINE_METHODDEF
20502088
SYS_UNRAISABLEHOOK_METHODDEF
20512089
#ifdef Py_STATS
20522090
SYS__STATS_ON_METHODDEF

0 commit comments

Comments
 (0)