Skip to content

bpo-38070: _Py_DumpTraceback() writes <no Python frame> #16244

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 17, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions Python/traceback.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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();
}

Expand Down