@@ -500,7 +500,8 @@ sys_addaudithook_impl(PyObject *module, PyObject *hook)
500
500
}
501
501
502
502
PyDoc_STRVAR (audit_doc ,
503
- "audit(event, *args)\n\
503
+ "audit($module, event, /, *args)\n\
504
+ --\n\
504
505
\n\
505
506
Passes the event to any audit hooks that are attached." );
506
507
@@ -644,7 +645,8 @@ sys_breakpointhook(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyOb
644
645
}
645
646
646
647
PyDoc_STRVAR (breakpointhook_doc ,
647
- "breakpointhook(*args, **kws)\n"
648
+ "breakpointhook($module, /, *args, **kwargs)\n"
649
+ "--\n"
648
650
"\n"
649
651
"This hook function is called by built-in breakpoint().\n"
650
652
);
@@ -1085,34 +1087,40 @@ trace_trampoline(PyObject *self, PyFrameObject *frame,
1085
1087
return 0 ;
1086
1088
}
1087
1089
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
+
1088
1102
static PyObject *
1089
- sys_settrace (PyObject * self , PyObject * args )
1103
+ sys_settrace (PyObject * module , PyObject * function )
1104
+ /*[clinic end generated code: output=999d12e9d6ec4678 input=8107feb01c5f1c4e]*/
1090
1105
{
1091
1106
PyThreadState * tstate = _PyThreadState_GET ();
1092
- if (args == Py_None ) {
1107
+ if (function == Py_None ) {
1093
1108
if (_PyEval_SetTrace (tstate , NULL , NULL ) < 0 ) {
1094
1109
return NULL ;
1095
1110
}
1096
1111
}
1097
1112
else {
1098
- if (_PyEval_SetTrace (tstate , trace_trampoline , args ) < 0 ) {
1113
+ if (_PyEval_SetTrace (tstate , trace_trampoline , function ) < 0 ) {
1099
1114
return NULL ;
1100
1115
}
1101
1116
}
1102
1117
Py_RETURN_NONE ;
1103
1118
}
1104
1119
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
-
1112
1120
/*[clinic input]
1113
1121
sys._settraceallthreads
1114
1122
1115
- arg: object
1123
+ function as arg: object
1116
1124
/
1117
1125
1118
1126
Set the global debug tracing function in all running threads belonging to the current interpreter.
@@ -1123,7 +1131,7 @@ in the library manual.
1123
1131
1124
1132
static PyObject *
1125
1133
sys__settraceallthreads (PyObject * module , PyObject * arg )
1126
- /*[clinic end generated code: output=161cca30207bf3ca input=5906aa1485a50289 ]*/
1134
+ /*[clinic end generated code: output=161cca30207bf3ca input=d4bde1f810d73675 ]*/
1127
1135
{
1128
1136
PyObject * argument = NULL ;
1129
1137
Py_tracefunc func = NULL ;
@@ -1159,45 +1167,51 @@ sys_gettrace_impl(PyObject *module)
1159
1167
return Py_NewRef (temp );
1160
1168
}
1161
1169
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
+
1162
1182
static PyObject *
1163
- sys_setprofile (PyObject * self , PyObject * args )
1183
+ sys_setprofile (PyObject * module , PyObject * function )
1184
+ /*[clinic end generated code: output=1c3503105939db9c input=055d0d7961413a62]*/
1164
1185
{
1165
1186
PyThreadState * tstate = _PyThreadState_GET ();
1166
- if (args == Py_None ) {
1187
+ if (function == Py_None ) {
1167
1188
if (_PyEval_SetProfile (tstate , NULL , NULL ) < 0 ) {
1168
1189
return NULL ;
1169
1190
}
1170
1191
}
1171
1192
else {
1172
- if (_PyEval_SetProfile (tstate , profile_trampoline , args ) < 0 ) {
1193
+ if (_PyEval_SetProfile (tstate , profile_trampoline , function ) < 0 ) {
1173
1194
return NULL ;
1174
1195
}
1175
1196
}
1176
1197
Py_RETURN_NONE ;
1177
1198
}
1178
1199
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
-
1186
1200
/*[clinic input]
1187
1201
sys._setprofileallthreads
1188
1202
1189
- arg: object
1203
+ function as arg: object
1190
1204
/
1191
1205
1192
1206
Set the profiling function in all running threads belonging to the current interpreter.
1193
1207
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.
1196
1210
[clinic start generated code]*/
1197
1211
1198
1212
static PyObject *
1199
1213
sys__setprofileallthreads (PyObject * module , PyObject * arg )
1200
- /*[clinic end generated code: output=2d61319e27b309fe input=d1a356d3f4f9060a ]*/
1214
+ /*[clinic end generated code: output=2d61319e27b309fe input=a10589439ba20cee ]*/
1201
1215
{
1202
1216
PyObject * argument = NULL ;
1203
1217
Py_tracefunc func = NULL ;
@@ -2525,11 +2539,11 @@ static PyMethodDef sys_methods[] = {
2525
2539
SYS_SETSWITCHINTERVAL_METHODDEF
2526
2540
SYS_GETSWITCHINTERVAL_METHODDEF
2527
2541
SYS_SETDLOPENFLAGS_METHODDEF
2528
- { "setprofile" , sys_setprofile , METH_O , setprofile_doc },
2542
+ SYS_SETPROFILE_METHODDEF
2529
2543
SYS__SETPROFILEALLTHREADS_METHODDEF
2530
2544
SYS_GETPROFILE_METHODDEF
2531
2545
SYS_SETRECURSIONLIMIT_METHODDEF
2532
- { "settrace" , sys_settrace , METH_O , settrace_doc },
2546
+ SYS_SETTRACE_METHODDEF
2533
2547
SYS__SETTRACEALLTHREADS_METHODDEF
2534
2548
SYS_GETTRACE_METHODDEF
2535
2549
SYS_CALL_TRACING_METHODDEF
0 commit comments