Skip to content

Commit 0b11f0e

Browse files
[3.12] gh-117764: Add signatures for functions in the faulthandler module (GH-117771) (GH-117806)
(cherry picked from commit 245e426) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
1 parent aeb4ac7 commit 0b11f0e

File tree

1 file changed

+35
-26
lines changed

1 file changed

+35
-26
lines changed

Modules/faulthandler.c

Lines changed: 35 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,58 +1183,67 @@ PyDoc_STRVAR(module_doc,
11831183
static PyMethodDef module_methods[] = {
11841184
{"enable",
11851185
_PyCFunction_CAST(faulthandler_py_enable), METH_VARARGS|METH_KEYWORDS,
1186-
PyDoc_STR("enable(file=sys.stderr, all_threads=True): "
1187-
"enable the fault handler")},
1186+
PyDoc_STR("enable($module, /, file=sys.stderr, all_threads=True)\n--\n\n"
1187+
"Enable the fault handler.")},
11881188
{"disable", faulthandler_disable_py, METH_NOARGS,
1189-
PyDoc_STR("disable(): disable the fault handler")},
1189+
PyDoc_STR("disable($module, /)\n--\n\n"
1190+
"Disable the fault handler.")},
11901191
{"is_enabled", faulthandler_is_enabled, METH_NOARGS,
1191-
PyDoc_STR("is_enabled()->bool: check if the handler is enabled")},
1192+
PyDoc_STR("is_enabled($module, /)\n--\n\n"
1193+
"Check if the handler is enabled.")},
11921194
{"dump_traceback",
11931195
_PyCFunction_CAST(faulthandler_dump_traceback_py), METH_VARARGS|METH_KEYWORDS,
1194-
PyDoc_STR("dump_traceback(file=sys.stderr, all_threads=True): "
1195-
"dump the traceback of the current thread, or of all threads "
1196-
"if all_threads is True, into file")},
1196+
PyDoc_STR("dump_traceback($module, /, file=sys.stderr, all_threads=True)\n--\n\n"
1197+
"Dump the traceback of the current thread, or of all threads "
1198+
"if all_threads is True, into file.")},
11971199
{"dump_traceback_later",
11981200
_PyCFunction_CAST(faulthandler_dump_traceback_later), METH_VARARGS|METH_KEYWORDS,
1199-
PyDoc_STR("dump_traceback_later(timeout, repeat=False, file=sys.stderr, exit=False):\n"
1200-
"dump the traceback of all threads in timeout seconds,\n"
1201+
PyDoc_STR("dump_traceback_later($module, /, timeout, repeat=False, file=sys.stderr, exit=False)\n--\n\n"
1202+
"Dump the traceback of all threads in timeout seconds,\n"
12011203
"or each timeout seconds if repeat is True. If exit is True, "
12021204
"call _exit(1) which is not safe.")},
12031205
{"cancel_dump_traceback_later",
12041206
faulthandler_cancel_dump_traceback_later_py, METH_NOARGS,
1205-
PyDoc_STR("cancel_dump_traceback_later():\ncancel the previous call "
1206-
"to dump_traceback_later().")},
1207+
PyDoc_STR("cancel_dump_traceback_later($module, /)\n--\n\n"
1208+
"Cancel the previous call to dump_traceback_later().")},
12071209
#ifdef FAULTHANDLER_USER
12081210
{"register",
12091211
_PyCFunction_CAST(faulthandler_register_py), METH_VARARGS|METH_KEYWORDS,
1210-
PyDoc_STR("register(signum, file=sys.stderr, all_threads=True, chain=False): "
1211-
"register a handler for the signal 'signum': dump the "
1212+
PyDoc_STR("register($module, /, signum, file=sys.stderr, all_threads=True, chain=False)\n--\n\n"
1213+
"Register a handler for the signal 'signum': dump the "
12121214
"traceback of the current thread, or of all threads if "
1213-
"all_threads is True, into file")},
1215+
"all_threads is True, into file.")},
12141216
{"unregister",
1215-
_PyCFunction_CAST(faulthandler_unregister_py), METH_VARARGS|METH_KEYWORDS,
1216-
PyDoc_STR("unregister(signum): unregister the handler of the signal "
1217-
"'signum' registered by register()")},
1217+
_PyCFunction_CAST(faulthandler_unregister_py), METH_VARARGS,
1218+
PyDoc_STR("unregister($module, signum, /)\n--\n\n"
1219+
"Unregister the handler of the signal "
1220+
"'signum' registered by register().")},
12181221
#endif
12191222
{"_read_null", faulthandler_read_null, METH_NOARGS,
1220-
PyDoc_STR("_read_null(): read from NULL, raise "
1221-
"a SIGSEGV or SIGBUS signal depending on the platform")},
1223+
PyDoc_STR("_read_null($module, /)\n--\n\n"
1224+
"Read from NULL, raise "
1225+
"a SIGSEGV or SIGBUS signal depending on the platform.")},
12221226
{"_sigsegv", faulthandler_sigsegv, METH_VARARGS,
1223-
PyDoc_STR("_sigsegv(release_gil=False): raise a SIGSEGV signal")},
1227+
PyDoc_STR("_sigsegv($module, release_gil=False, /)\n--\n\n"
1228+
"Raise a SIGSEGV signal.")},
12241229
{"_fatal_error_c_thread", faulthandler_fatal_error_c_thread, METH_NOARGS,
1225-
PyDoc_STR("fatal_error_c_thread(): "
1226-
"call Py_FatalError() in a new C thread.")},
1230+
PyDoc_STR("_fatal_error_c_thread($module, /)\n--\n\n"
1231+
"Call Py_FatalError() in a new C thread.")},
12271232
{"_sigabrt", faulthandler_sigabrt, METH_NOARGS,
1228-
PyDoc_STR("_sigabrt(): raise a SIGABRT signal")},
1233+
PyDoc_STR("_sigabrt($module, /)\n--\n\n"
1234+
"Raise a SIGABRT signal.")},
12291235
{"_sigfpe", (PyCFunction)faulthandler_sigfpe, METH_NOARGS,
1230-
PyDoc_STR("_sigfpe(): raise a SIGFPE signal")},
1236+
PyDoc_STR("_sigfpe($module, /)\n--\n\n"
1237+
"Raise a SIGFPE signal.")},
12311238
#ifdef FAULTHANDLER_STACK_OVERFLOW
12321239
{"_stack_overflow", faulthandler_stack_overflow, METH_NOARGS,
1233-
PyDoc_STR("_stack_overflow(): recursive call to raise a stack overflow")},
1240+
PyDoc_STR("_stack_overflow($module, /)\n--\n\n"
1241+
"Recursive call to raise a stack overflow.")},
12341242
#endif
12351243
#ifdef MS_WINDOWS
12361244
{"_raise_exception", faulthandler_raise_exception, METH_VARARGS,
1237-
PyDoc_STR("raise_exception(code, flags=0): Call RaiseException(code, flags).")},
1245+
PyDoc_STR("_raise_exception($module, code, flags=0, /)\n--\n\n"
1246+
"Call RaiseException(code, flags).")},
12381247
#endif
12391248
{NULL, NULL} /* sentinel */
12401249
};

0 commit comments

Comments
 (0)