summaryrefslogtreecommitdiffstats
path: root/Python/traceback.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2021-06-21 12:23:13 (GMT)
committerGitHub <noreply@github.com>2021-06-21 12:23:13 (GMT)
commit9b0bbb9143d15507aae0ff3afeb05969178b306c (patch)
treec3557da65fa706a1f1dc524148c9138852d9b185 /Python/traceback.c
parent7674c83d81905d6afe989ca3f93f08b7939b057c (diff)
downloadcpython-9b0bbb9143d15507aae0ff3afeb05969178b306c.zip
cpython-9b0bbb9143d15507aae0ff3afeb05969178b306c.tar.gz
cpython-9b0bbb9143d15507aae0ff3afeb05969178b306c.tar.bz2
bpo-44466: Faulthandler now detects the GC (GH-26823) (GH-26826)
The faulthandler module now detects if a fatal error occurs during a garbage collector collection (only if all_threads is true). (cherry picked from commit d19163912bfc790283724f05328bd31e4e65003d)
Diffstat (limited to 'Python/traceback.c')
-rw-r--r--Python/traceback.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Python/traceback.c b/Python/traceback.c
index 470324b1..f7dc5ad 100644
--- a/Python/traceback.c
+++ b/Python/traceback.c
@@ -4,6 +4,7 @@
#include "Python.h"
#include "code.h"
+#include "pycore_interp.h" // PyInterpreterState.gc
#include "frameobject.h" // PyFrame_GetBack()
#include "structmember.h" // PyMemberDef
#include "osdefs.h" // SEP
@@ -914,6 +915,9 @@ _Py_DumpTracebackThreads(int fd, PyInterpreterState *interp,
break;
}
write_thread_id(fd, tstate, tstate == current_tstate);
+ if (tstate == current_tstate && tstate->interp->gc.collecting) {
+ PUTS(fd, " Garbage-collecting\n");
+ }
dump_traceback(fd, tstate, 0);
tstate = PyThreadState_Next(tstate);
nthreads++;