bpo-38070: _Py_DumpTraceback() writes (GH-16244) · python/cpython@8fa3e17 (original) (raw)
`@@ -797,12 +797,15 @@ dump_traceback(int fd, PyThreadState *tstate, int write_header)
`
797
797
`PyFrameObject *frame;
`
798
798
`unsigned int depth;
`
799
799
``
800
``
`-
if (write_header)
`
``
800
`+
if (write_header) {
`
801
801
`PUTS(fd, "Stack (most recent call first):\n");
`
``
802
`+
}
`
802
803
``
803
804
`frame = _PyThreadState_GetFrame(tstate);
`
804
``
`-
if (frame == NULL)
`
``
805
`+
if (frame == NULL) {
`
``
806
`+
PUTS(fd, "\n");
`
805
807
`return;
`
``
808
`+
}
`
806
809
``
807
810
`depth = 0;
`
808
811
`while (frame != NULL) {
`
`@@ -870,9 +873,9 @@ _Py_DumpTracebackThreads(int fd, PyInterpreterState *interp,
`
870
873
` Python thread state of the current thread.
`
871
874
``
872
875
` PyThreadState_Get() doesn't give the state of the thread that caused
`
873
``
`-
the fault if the thread released the GIL, and so this function
`
874
``
`-
cannot be used. Read the thread specific storage (TSS) instead: call
`
875
``
`-
PyGILState_GetThisThreadState(). */
`
``
876
`+
the fault if the thread released the GIL, and so
`
``
877
`+
_PyThreadState_GET() cannot be used. Read the thread specific
`
``
878
`+
storage (TSS) instead: call PyGILState_GetThisThreadState(). */
`
876
879
`current_tstate = PyGILState_GetThisThreadState();
`
877
880
` }
`
878
881
``