@@ -500,7 +500,8 @@ sys_addaudithook_impl(PyObject *module, PyObject *hook)
500500}
501501
502502PyDoc_STRVAR (audit_doc ,
503- "audit(event, *args)\n\
503+ "audit($module, event, /, *args)\n\
504+ --\n\
504505\n\
505506Passes the event to any audit hooks that are attached." );
506507
@@ -644,7 +645,8 @@ sys_breakpointhook(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyOb
644645}
645646
646647PyDoc_STRVAR (breakpointhook_doc ,
647- "breakpointhook(*args, **kws)\n"
648+ "breakpointhook($module, /, *args, **kwargs)\n"
649+ "--\n"
648650"\n"
649651"This hook function is called by built-in breakpoint().\n"
650652);
@@ -1085,34 +1087,40 @@ trace_trampoline(PyObject *self, PyFrameObject *frame,
10851087 return 0 ;
10861088}
10871089
1090+ /*[clinic input]
1091+ sys.settrace
1092+
1093+ function: object
1094+ /
1095+
1096+ Set the global debug tracing function.
1097+
1098+ It will be called on each function call. See the debugger chapter
1099+ in the library manual.
1100+ [clinic start generated code]*/
1101+
10881102static PyObject *
1089- sys_settrace (PyObject * self , PyObject * args )
1103+ sys_settrace (PyObject * module , PyObject * function )
1104+ /*[clinic end generated code: output=999d12e9d6ec4678 input=8107feb01c5f1c4e]*/
10901105{
10911106 PyThreadState * tstate = _PyThreadState_GET ();
1092- if (args == Py_None ) {
1107+ if (function == Py_None ) {
10931108 if (_PyEval_SetTrace (tstate , NULL , NULL ) < 0 ) {
10941109 return NULL ;
10951110 }
10961111 }
10971112 else {
1098- if (_PyEval_SetTrace (tstate , trace_trampoline , args ) < 0 ) {
1113+ if (_PyEval_SetTrace (tstate , trace_trampoline , function ) < 0 ) {
10991114 return NULL ;
11001115 }
11011116 }
11021117 Py_RETURN_NONE ;
11031118}
11041119
1105- PyDoc_STRVAR (settrace_doc ,
1106- "settrace(function)\n\
1107- \n\
1108- Set the global debug tracing function. It will be called on each\n\
1109- function call. See the debugger chapter in the library manual."
1110- );
1111-
11121120/*[clinic input]
11131121sys._settraceallthreads
11141122
1115- arg: object
1123+ function as arg: object
11161124 /
11171125
11181126Set the global debug tracing function in all running threads belonging to the current interpreter.
@@ -1123,7 +1131,7 @@ in the library manual.
11231131
11241132static PyObject *
11251133sys__settraceallthreads (PyObject * module , PyObject * arg )
1126- /*[clinic end generated code: output=161cca30207bf3ca input=5906aa1485a50289 ]*/
1134+ /*[clinic end generated code: output=161cca30207bf3ca input=d4bde1f810d73675 ]*/
11271135{
11281136 PyObject * argument = NULL ;
11291137 Py_tracefunc func = NULL ;
@@ -1159,45 +1167,51 @@ sys_gettrace_impl(PyObject *module)
11591167 return Py_NewRef (temp );
11601168}
11611169
1170+ /*[clinic input]
1171+ sys.setprofile
1172+
1173+ function: object
1174+ /
1175+
1176+ Set the profiling function.
1177+
1178+ It will be called on each function call and return. See the profiler
1179+ chapter in the library manual.
1180+ [clinic start generated code]*/
1181+
11621182static PyObject *
1163- sys_setprofile (PyObject * self , PyObject * args )
1183+ sys_setprofile (PyObject * module , PyObject * function )
1184+ /*[clinic end generated code: output=1c3503105939db9c input=055d0d7961413a62]*/
11641185{
11651186 PyThreadState * tstate = _PyThreadState_GET ();
1166- if (args == Py_None ) {
1187+ if (function == Py_None ) {
11671188 if (_PyEval_SetProfile (tstate , NULL , NULL ) < 0 ) {
11681189 return NULL ;
11691190 }
11701191 }
11711192 else {
1172- if (_PyEval_SetProfile (tstate , profile_trampoline , args ) < 0 ) {
1193+ if (_PyEval_SetProfile (tstate , profile_trampoline , function ) < 0 ) {
11731194 return NULL ;
11741195 }
11751196 }
11761197 Py_RETURN_NONE ;
11771198}
11781199
1179- PyDoc_STRVAR (setprofile_doc ,
1180- "setprofile(function)\n\
1181- \n\
1182- Set the profiling function. It will be called on each function call\n\
1183- and return. See the profiler chapter in the library manual."
1184- );
1185-
11861200/*[clinic input]
11871201sys._setprofileallthreads
11881202
1189- arg: object
1203+ function as arg: object
11901204 /
11911205
11921206Set the profiling function in all running threads belonging to the current interpreter.
11931207
1194- It will be called on each function call and return. See the profiler chapter
1195- in the library manual.
1208+ It will be called on each function call and return. See the profiler
1209+ chapter in the library manual.
11961210[clinic start generated code]*/
11971211
11981212static PyObject *
11991213sys__setprofileallthreads (PyObject * module , PyObject * arg )
1200- /*[clinic end generated code: output=2d61319e27b309fe input=d1a356d3f4f9060a ]*/
1214+ /*[clinic end generated code: output=2d61319e27b309fe input=a10589439ba20cee ]*/
12011215{
12021216 PyObject * argument = NULL ;
12031217 Py_tracefunc func = NULL ;
@@ -2525,11 +2539,11 @@ static PyMethodDef sys_methods[] = {
25252539 SYS_SETSWITCHINTERVAL_METHODDEF
25262540 SYS_GETSWITCHINTERVAL_METHODDEF
25272541 SYS_SETDLOPENFLAGS_METHODDEF
2528- { "setprofile" , sys_setprofile , METH_O , setprofile_doc },
2542+ SYS_SETPROFILE_METHODDEF
25292543 SYS__SETPROFILEALLTHREADS_METHODDEF
25302544 SYS_GETPROFILE_METHODDEF
25312545 SYS_SETRECURSIONLIMIT_METHODDEF
2532- { "settrace" , sys_settrace , METH_O , settrace_doc },
2546+ SYS_SETTRACE_METHODDEF
25332547 SYS__SETTRACEALLTHREADS_METHODDEF
25342548 SYS_GETTRACE_METHODDEF
25352549 SYS_CALL_TRACING_METHODDEF
0 commit comments