summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-05-07 10:43:00 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-05-07 10:43:00 (GMT)
commit7bba62fd68e3a2c410c37348cf679edea04c7718 (patch)
tree41614a5367bd7c7586df0eb3f53e3c7db7b3f362 /Modules
parentc925617b5455867b7b393c6ca66f133aab450a6b (diff)
downloadcpython-7bba62fd68e3a2c410c37348cf679edea04c7718.zip
cpython-7bba62fd68e3a2c410c37348cf679edea04c7718.tar.gz
cpython-7bba62fd68e3a2c410c37348cf679edea04c7718.tar.bz2
faulthandler: dump all threads by default
* Set the default value of all_threads arguments to True * Py_FatalError() dumps all threads, instead of only the current thread Dump only the current thread is not reliable. In some cases, Python is unable to retrieve the state of the current thread and so is unable to dump the traceback. faulthandler keeps a reference to the interpreter and so is always able to dump the traceback of all threads.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/faulthandler.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c
index 8f83ab8..6041485 100644
--- a/Modules/faulthandler.c
+++ b/Modules/faulthandler.c
@@ -186,7 +186,7 @@ faulthandler_dump_traceback_py(PyObject *self,
{
static char *kwlist[] = {"file", "all_threads", NULL};
PyObject *file = NULL;
- int all_threads = 0;
+ int all_threads = 1;
PyThreadState *tstate;
const char *errmsg;
int fd;
@@ -306,7 +306,7 @@ faulthandler_enable(PyObject *self, PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = {"file", "all_threads", NULL};
PyObject *file = NULL;
- int all_threads = 0;
+ int all_threads = 1;
unsigned int i;
fault_handler_t *handler;
#ifdef HAVE_SIGACTION
@@ -648,7 +648,7 @@ faulthandler_register(PyObject *self,
static char *kwlist[] = {"signum", "file", "all_threads", NULL};
int signum;
PyObject *file = NULL;
- int all_threads = 0;
+ int all_threads = 1;
int fd;
user_signal_t *user;
_Py_sighandler_t previous;
@@ -916,7 +916,7 @@ PyDoc_STRVAR(module_doc,
static PyMethodDef module_methods[] = {
{"enable",
(PyCFunction)faulthandler_enable, METH_VARARGS|METH_KEYWORDS,
- PyDoc_STR("enable(file=sys.stderr, all_threads=False): "
+ PyDoc_STR("enable(file=sys.stderr, all_threads=True): "
"enable the fault handler")},
{"disable", (PyCFunction)faulthandler_disable_py, METH_NOARGS,
PyDoc_STR("disable(): disable the fault handler")},
@@ -924,7 +924,7 @@ static PyMethodDef module_methods[] = {
PyDoc_STR("is_enabled()->bool: check if the handler is enabled")},
{"dump_traceback",
(PyCFunction)faulthandler_dump_traceback_py, METH_VARARGS|METH_KEYWORDS,
- PyDoc_STR("dump_traceback(file=sys.stderr, all_threads=False): "
+ PyDoc_STR("dump_traceback(file=sys.stderr, all_threads=True): "
"dump the traceback of the current thread, or of all threads "
"if all_threads is True, into file")},
#ifdef FAULTHANDLER_LATER
@@ -943,7 +943,7 @@ static PyMethodDef module_methods[] = {
#ifdef FAULTHANDLER_USER
{"register",
(PyCFunction)faulthandler_register, METH_VARARGS|METH_KEYWORDS,
- PyDoc_STR("register(signum, file=sys.stderr, all_threads=False): "
+ PyDoc_STR("register(signum, file=sys.stderr, all_threads=True): "
"register an handler for the signal 'signum': dump the "
"traceback of the current thread, or of all threads if "
"all_threads is True, into file")},