diff options
author | Victor Stinner <vstinner@redhat.com> | 2019-09-18 12:10:16 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-18 12:10:16 (GMT) |
commit | 47bbab9f76735acc1991e541d12fd18be6b13b16 (patch) | |
tree | deda23c37efb7ae3a1d084cd4b4388e773e450d1 /Python/traceback.c | |
parent | 7a2f68776a77c782c0abf40dc9e3fb687787e730 (diff) | |
download | cpython-47bbab9f76735acc1991e541d12fd18be6b13b16.zip cpython-47bbab9f76735acc1991e541d12fd18be6b13b16.tar.gz cpython-47bbab9f76735acc1991e541d12fd18be6b13b16.tar.bz2 |
[3.8] bpo-38070: Py_FatalError() logs runtime state (GH-16258)
* bpo-38070: _Py_DumpTraceback() writes <no Python frame> (GH-16244)
When a Python thread has no frame, _Py_DumpTraceback() and
_Py_DumpTracebackThreads() now write "<no Python frame>", rather than
writing nothing.
(cherry picked from commit 8fa3e1740b3f03ea65ddb68411c2238c5f98eec2)
* bpo-38070: Enhance _PyObject_Dump() (GH-16243)
_PyObject_Dump() now dumps the object address for freed objects and
objects with ob_type=NULL.
(cherry picked from commit b39afb78768418d9405c4b528c80fa968ccc974d)
* bpo-38070: Add _PyRuntimeState.preinitializing (GH-16245)
Add _PyRuntimeState.preinitializing field: set to 1 while
Py_PreInitialize() is running.
_PyRuntimeState: rename also pre_initialized field to preinitialized.
(cherry picked from commit d3b904144e86e2442961de6a7dccecbe133d5c6d)
* bpo-38070: Py_FatalError() logs runtime state (GH-16246)
(cherry picked from commit 1ce16fb0977283ae42a9f8917bbca5f44aa69324)
Diffstat (limited to 'Python/traceback.c')
-rw-r--r-- | Python/traceback.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Python/traceback.c b/Python/traceback.c index 0463eb6..8e2f15e 100644 --- a/Python/traceback.c +++ b/Python/traceback.c @@ -797,12 +797,15 @@ dump_traceback(int fd, PyThreadState *tstate, int write_header) PyFrameObject *frame; unsigned int depth; - if (write_header) + if (write_header) { PUTS(fd, "Stack (most recent call first):\n"); + } frame = _PyThreadState_GetFrame(tstate); - if (frame == NULL) + if (frame == NULL) { + PUTS(fd, "<no Python frame>\n"); return; + } depth = 0; while (frame != NULL) { @@ -870,9 +873,9 @@ _Py_DumpTracebackThreads(int fd, PyInterpreterState *interp, Python thread state of the current thread. PyThreadState_Get() doesn't give the state of the thread that caused - the fault if the thread released the GIL, and so this function - cannot be used. Read the thread specific storage (TSS) instead: call - PyGILState_GetThisThreadState(). */ + the fault if the thread released the GIL, and so + _PyThreadState_GET() cannot be used. Read the thread specific + storage (TSS) instead: call PyGILState_GetThisThreadState(). */ current_tstate = PyGILState_GetThisThreadState(); } |